Skip to main content
fix header
Source Link
user45941
user45941

JavaScript, 34ch

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

##JavaScript, 34 bytes 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.

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.

##JavaScript, 34 bytes 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.

added 1 character in body
Source Link
jimmy23013
  • 37k
  • 6
  • 77
  • 148

JavaScript, 34ch

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

(or)

function f(n){return n?n\*fn*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.

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.

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.

added 6 characters in body
Source Link
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}

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

Explanation:
Function 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.

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.

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.

Source Link
ricdesi
  • 509
  • 2
  • 13
Loading