Skip to main content
3 of 4
added 1 character in body
jimmy23013
  • 37.4k
  • 6
  • 79
  • 154

JavaScript, 34ch

function f(n){return n?n*f(n-1):1} 

(or)

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
  • 519
  • 2
  • 13