One line function for factorial of a number | Javascript program to find factorial of given number ; single line to find factorial ; Driver Code
function factorial ( n ) { return ( n == 1 n == 0 ) ? 1 : n * factorial ( n - 1 ) ; } let num = 5 ; document . write ( " " , num , " " , factorial ( num ) ) ;