Lesson 10


#1


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


I don't understand what is wrong iwth this code, i keep on getting the syntax error -

SyntaxError: missing ) after condition


var getToDaChoppa = function() {
    var arnie = 1
    do {
        console.log("I am programmed to protect John Connor");
    } while(arnie<2; arnie++);
}

getToDaChoppa();


#2

this a do while loop, arnie++ should be inside the loop:

do { 
  arnie ++;
} while(condition)

the while loop can only have a condition, not the increment of a variable, that should be inside the loop itself


#3

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