Doubt regarding alternate method

Tell us what’s happening:
I was wondering why the code would not run if we changed the for loop to the following:
for(let i =num; i>=1; i–)

The program seems to always return product as 1 when this loop is used.

Hope my question is clear.

  **Your code so far**

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

  **Your browser information:**

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

Challenge: Factorialize a Number

Link to the challenge:

can you please post the code with that change?
so we can see the code you are talking about?

Thank you for your response. I figured out it was just a minor error I ended up making in the code. I was able to find it myself. I couldn’t figure out how to close the topic that’s why it is still here. Thank again for your reply.

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