I get “SyntaxError: Unexpected token else” in 6/11 when I write the code myself, but it runs just fine if I push “Get code” or if I copy/paste the code “Get code” gives me. I swear the code is identical in both cases.
let moonPhase = ‘full’;
if (moonPhase === ‘full’); {
console.log(‘Howl!’);
} else {
console.log(‘I swear I am not a werewolf.’);
}
When an error is pointed out, look for the cause. In this case, the else is not the cause; therefore, it must be higher up in the code. Check the syntax.
The fact still remains, though, that the code I’ve written is identical to what the “Get code” gives me, but my text won’t compile, unlike the identical corrected version.