re: Factorial Algorithm: ES5 & ES6 JavaScript Solutions VIEW POST

VIEW FULL DISCUSSION
 

I like when my code is executed vertically.
Probably too verbose but I like the "clean" feel to it.

const factorial = (x) => {
  if (x === 0){
    return 1;
  } else if(x === 1) {
    return x;
  } else {
    return x * factorial(x - 1) 
  }
}
code of conduct - report abuse