Trying to factorialize a number. Confused as to why my function wont work

Hello everyone. I’m working on the Basic Algorithm Scripting: Factorialize a Number challenge. In my mind this should work but it doesn’t. Can anyone see any glaringly obvious issues? Thanks

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

factorialize(5);

Whatever number you multiply for 0, it stay 0, runningCount will always be 0.

let runningCount = 0;

Try setting the starting value to 1, as the neutral number in multiplication is 1

1 Like

Thank you you so much for your help! Can’t believe how simple that was. Doh!