5. Controlling the for loop freezes.... Can't see the issue!


#1


Counting by 5s from 5 to 50....

https://www.codecademy.com/courses/javascript-beginner-en-NhsaT/0/5?curriculum_id=506324b3a7dffd00020bf661#

When I run my code, my browser freezes... I can't see where my screwup is. Anyone see anything odd?


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


Thanks!


#2

it is a infinity loop. look:

i = 5
console.log(i + 5); // will log 10
console.log(i); // will log 5
i = i + 5
console.log(i); // will log 10

you do need to update i, i + 5 is just temporary.


#3

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