Page crash pls help


#1

I dont create an infinite loop but my page becomes unresponsive after i hit the submit code button. I'm really stuck and dont know what to. pls help.
Here' s my code:
for(int i=5;i<51;i+5)
console.log(i);

Thanks in advance.


#2

i+5 is not the right syntax. You are telling it how much to increase. To tell it to increase by 5, you would say i+=5 since you're not really increasing i, you are creating an infinite loop.


#3

code after modifying :
for(int i=5;i<51;i+=5)
console.log(i);
could you tell me where i'm wrong?
Now the page has become responsive but shows some error.
thanks a lot.


#4

You don't have {}? Also, int isn't how you set a variable in javascript. You use var.

for (var i = 5; i < 51; i += 5){
    console.log(i);
};

#5

Oh, got it. Since i' m learning other languages too..got off a bit.
Thanks, it really. God bless you. :smile:


#6

you have to write it as 1 = 1+5 not i=5


#7

Thanks! I got it already.


#8

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