Why is this while loop crashing the browser?


function sololoop(){
var ite = 89;
while (ite<90)
console.log("looped once!");



Because you're missing the {} after the while loop. This is ok, but it means that it will only work on the very next statement which is in you're case the console.log so your effective loop is this:

[var ite = 89;] // just to show that the condition is true
while (ite<90)
console.log("looped once!");

the whole rest will only be executed when this loop is done, which is never. So wrap the stuff you want to belong to the loop inside of {}.


coz your condition is true ..remember while loop is whatever its true it runs forever...

so you have to make it false. and then its gonna stop


He (or she) tried to make it false by ite++;. But as said the problem is that this part does not belong to the loop because of the missing {}.


Thank you very much!