When to 'while' and when to 'for' Issue


#1

https://www.codecademy.com/en/courses/javascript-beginner-en-ASGIv/2/1?curriculum_id=506324b3a7dffd00020bf661

Browser is crashing, don't know why, doesn't appear to be an infinite loop.


for(var i = 1; i < 10; i++){
    console.log(i);  
};

var progress = 3;
while(progress < 15){
    console.log("Not done looping");
    progress +3;
};


#2
progress += 3 will increase by three each time.

If you don't want a strange number appearing in the console, put this line before the console.log() statement.


#3

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