Unexpected behaviour|as i hit Save and Submit Button browser stops responding does not allow me to proceed with the Course


I am doing Your First "for" Loop exercise after i type my code and Click on Save and Submit button it shows me very unexpected kind of behaviour browser freezes and stops responding. I have tried to do this same exercise on different browsers but nothing is working or me.

I got a message that some script are not working. can some please help me?? I am Stuck not able to proceed with my Course

Please Help


well yes, that is indeed a danger button if you have a infinity loop. You have an infinity loop, a for loop exist of 3 parts, the first one is to initialize:

i = 0;

which you did fine, then the second point is to tell when to run:


which is not so fine, text.length is a value, yes, but you never compare it to i, you might want to keep the loop running while i is smaller then text.length:

i < text.length