Error on factorialize a number

Hey guys I’m kinda confused here I did the following code, but it keeps coming back as an error, am I missing something this is supposed to multiply from 12345

function factorialize(num) {
let result = 1;
  for (let i= 1; i < num; i++) {
    result = result * i;
  }
return result;
}

factorialize(5);
  **Your browser information:**

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.64 Safari/537.36

Challenge: Factorialize a Number

Link to the challenge:

If i < num and num = 5, then i is never 5.

Also, log the final line like console.log(factorialize(5)); to see what is really happening.

I console.log is shows up as 24 not 120, I’m gonna try a different method instead.

Your current method will work fine if you fix the problem @jeremy.a.gray pointed out. Will you ever multiply the result by num? What is 24*5?

24 * 5 would be 120 I’m still blind to it, I took a break gonna look at it again

for (let i=1; i<5; i++) {
  console.log("i is" + i);
}

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.