Factorialize a Number helpp

whats wrong in my code

Your code so far


function factorialize(num) {
if (num == 0 || num == 1){
  num = 1;
}
for (var i = num - 1;i>=1;i--){
  num*=i;
}
return num;
}

factorialize(5);
console.log(num);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-algorithm-scripting/factorialize-a-number

because num = 5 from before so 5*4 then 3 2 1

Your code isn’t wrong (except it is little annoying to read). Perhaps, reset and re-run the test?