The factorial of a number is the product of all the numbers from 1 to that number
Like factorial of 3 would be 1 x 2 x 3
function factorial (n) {
if (n <= 0) return 0
let i = fact = 1
while (i <= n) {
fact *= i
i++
}
return fact
}
const chai = require("chai");
const assert = chai.assert;
describe("Solution", function() {
it("should test for something", function() {
assert(factorial(5), 120);
assert(factorial(8),40320);
assert(factorial(15),1307674368000);
});
});