Tell us what’s happening:
This is how I solved the challenge Factorialize a Number. It doesn’t match any of the 4 solutions when I go in and check them on “Get A Hint”. Is this a bad way of doing it or are there just many solutions to this problem?
Your code so far
function factorialize(num) {
let result = 1;
for(let i = num; i > 0; i--) {
result *= num;
num--;
}
return result;
}
console.log(factorialize(5));
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36
Challenge: Basic Algorithm Scripting - Factorialize a Number
Link to the challenge: