Tell us what’s happening:
This is the solution I came up with and I’m getting undefined. Can someone help and just tell me if I’m close or completely screwing it up?
Thank you!
Your code so far
function factorialize(num) {
for (let i = num-1; i >= 0; i--)
if (num > 1) {
num = num * [i]
}
else if (num === 0 || num === 1){
num = 1}
else if (num )
return num;
}
console.log(factorialize(5));
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36.