11. Review (I keep getting an infinite loop!)


#1


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


Hi, somehow my code keeps becoming an infinite loop no matter what I do, and its really annoying having to refresh my work again and again. Please show me what I'm doing wrong, thanks!


for (var i = 3; i < 6; i--) {
    console.log("I got pulled over" + " " + i + " " + "times today!");
}

var j = true;

while (j) {
    console.log(Jasmine);
    j = false;
}

var k = true;

do {
    console.log(8+9);
    k = false;
} while(k);


#2

for (var i = 3; i < 6; i--)

i = 3
i = 2
i = 1
...
And so on while i < 6. So, you need to review your third condition.


#3

Also, you need to declare the variable Jasmine in the while loop


#4

Oh, that makes sense; I'll try that.


#5

Oh, that was meant to be a string, but yeah, then I probably should have put it in quotation marks. Thanks.


#6

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