Files
grokking_algorithms/03_recursion/ES6/03_factorial.js
Alexandr Shulaev 34df0a6d08 Fixed formatting problems and JSDoc (#131)
* Fixed formatting problems and JSDoc

* Added returns for JSDoc
2020-09-14 10:46:30 -05:00

12 lines
201 B
JavaScript

/**
* Consider the factorial of the number
* @param {number} x Number
* @returns {number} Result
*/
const fact = x => {
if (x === 1) return 1;
return x * fact(x - 1);
};
console.log(fact(5));