11. Review: For, Do, While- Syntax Error HELP


#1

Hey all,

Need some help with this one please.

Here's the link:
https://www.codecademy.com/courses/javascript-beginner-en-ASGIv/2/4?curriculum_id=506324b3a7dffd00020bf661#

I'm getting: SyntaxError: Unexpected token }

for (var i = 1; i < 10; i++) {
 console.log(i);   
}
var master = true;
    while (master) {
        console.log("Hello!");
        master = false;
    }
var mastering = false;
    do (mastering) { 
        console.log("I'm mastered!");
    }
        while (mastering = true);
    };

Thanks,

E


#2

var mastering = false;
    do (mastering) { 
        console.log("I'm mastered!");
    }
        while (mastering = true);
    }; // this semi-colon

see the comment, why is the }; there? It doesn't match to any {

your do while loop is an infinity loop, just so you know


#3

The }; was on the screen from the beginning.

How do I get rid of the do infinite loop?

Cheers!


#4

question everything, even what is already in the lesson

check if mastering equals true, don't assign mastering a value of true


#5

I'm not quite sure what's going on.

I tried this:

var mastering = true;
do (mastering) {
console.log("I'm mastered!");
mastering = false;
}
while (mastering = true);
}


#6

you still have the } after while, why?

a single euqal sign means assign, not check if equals


#7

I'm confused, which mastering below are you referring to?

var mastering = true;
do (mastering) {
console.log("I'm mastered!");
mastering = false;
}
while (mastering = true);


#8

the while loop condition, given its weird to assign in a loop condition


#9

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