jeudi 5 décembre 2019

Simple Control Flow Issue: Unexpected token 'else' [closed]

I am just barely learning Javascript and I can't seem to get this piece of code to run.

When I run the code below I get the error message:

Uncaught SyntaxError: Unexpected token 'else'

I am unsure of what the problem is. It looks fine to me. Here is the code:

var count = 0;

while (count < 11) {
    console.log(count);
    count++;
} else {
    console.log("complete");
}

Aucun commentaire:

Enregistrer un commentaire