text: Program for factorial of a number | function to find factorial of given number ; Driver Code
code: function factorial ( n ) { if ( n == 0 ) return 1 ; return n * factorial ( n - 1 ) ; } let num = 5 ; document . write ( " " + num + " " + factorial ( num ) ) ;