Programming-Idioms

History of Idiom 31 > diff from v48 to v49

Edit summary for version 49 :
New JS implementation by user [f]

Version 48

2019-09-26, 14:01:55

Version 49

2019-09-26, 14:36:02

Idiom #31 Recursive factorial (simple)

Create recursive function f which returns the factorial of non-negative integer i, calculated from f(i-1)

Idiom #31 Recursive factorial (simple)

Create recursive function f which returns the factorial of non-negative integer i, calculated from f(i-1)

Code
const fact = n => n === 0 ? 1 : n * fact(n-1)