Page unresponsive...!


#1


'

// Edit this for loop!

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


#2

Hi this line

for (var i = 5; i < 51; i+5)

this part

i+5

you should do it like that

i += 5
or
i = i + 5

#3

The reasoning is the following i+5 computes the value of i +5 which is 10 as i starts with 5. The problem is that we're not interested in the value itself here but the point of that 3rd for loop part is to change the value of i and that is not done by i+5. So what you need is a statement that changes the value of i e.g. i=i+5 or the shorter version i+=5. Small typo with big consequences, because if i doesn't change you're not able to finish the loop and therefore it will go on and on and on until your browsers refuses to run this script any longer.


#4

thank you so much it worked!!!


#5

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