Write a factorial function. factorial(n) = 1 * 2 * ... * n
,
e. g. factorial(4) = 1 * 2 * 3 * 4 = 24
.
You should use recursion instead of loops.
Small hint: absence of return
statement guarantees having no loops.
factorial(0); //=> 1
factorial(1); //=> 1
factorial(2); //=> 2
factorial(3); //=> 6
factorial(4); //=> 24
factorial(5); //=> 120
factorial(6); //=> 720
factorial(7); //=> 5040
// ...