DO/WHILE syntax error


I'm getting this error message: "SyntaxError: missing before statement." When I change the code to "while(x);" and "x=false;" it works fine and prints my line once, so I don't understand why I get a syntax error here.

var getToDaChoppa = function(){
    do {
      console.log("This should print four times.")
      } while(x < 4);

var x = 0;
var x += 1;



the placing of your var x = 0; and var x += 1; is not great. I would place them inside the function/loop. You figure it out. When updating a variable, not use the var keyword, using the var keyword will try to create a new variable instead of updating a old one


Thanks, I get it now. I set var "x" on line 1 and placed "x += 1" by itself after "console" line and it works fine.