Factorialize a Number help

Factorialize a Number help
0

#1

Tell us what’s happening:

Your code so far


function factorialize(num) {
 for (let i = 1;num >= 1; num--) {
      i = num * i;
  }
  return i;
}

factorialize(5);

Your browser information:

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

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


#2

You did not ask a specific question, but because you declared i inside the for loop, i has not meaning outside of it. The let keyword creates a block scope, so inside the { } is where i has a value. If you declare i outside the for loop, then you could return i as you are trying to do now.