For the code challenge section of JavaScript Practice: Arrays, Loops, Objects, Iterators…

Is there any way to make a for loop for the factorial function? I am not seeing any online so wonder if I am going in the complete wrong direction? So far I have:

function factorial(num) {
for (let i = num; i > 0; i--) {
newNum = (num) * i;
}
return newNum;
}

I am at a standstill so any help would be appreciated

I figured this out and you are very close. With the line newNum = (num) * i you are just multiplying i with the number you inputted not the product of the previous iteration of the loop. Now with that do you see what you need to change for this to work. You also need to change what the comparison is in the loop.

Currently, this is what the computer is doing if we put 5 as the argument (120 is the right answer):