Factorial of a Number error

Tell us what’s happening:
It should have been simple program , i am not able to point out the error.
when i run the program i get : infinity as output for num=5

Constructive criticism appreciated

Your code so far

function factorialize(num) {
  if (num>0){
     for(let i=1; i<num ; i++)
    return num;
  else if(num==0){
    return num=1;
   return undefined;


Your browser information:

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

Link to the challenge:

It’s in an infinite loop because you are comparing i with num but num is always changing.

Also you are actually not actually calculating product of all positive integers, instead you are multiplying given num with i’s instead.

Try using something other than num in your forloop.

understood, thnks that was terrible of me