Skip to main content
2 of 4
added 6 characters in body
jimmy23013
  • 37k
  • 6
  • 77
  • 148

JavaScript, 34ch

function f(n){return n?n\*f(n-1):1} <sub>*(or)*</sub>  
function f(n){return n?n\*f(--n):1}

###Explanation

Function takes in a value, returns itself multiplied by
if n != 0: the same function on the number decreased by one
if n == 0: 1

The final f(0) returns first with 1, times 1, times 2, etc.

Terminator removed, may upset use strict.

ricdesi
  • 509
  • 2
  • 13