This code is supposed to log Arms and legs are getting hairier to the console, however I keep receving this error:
/home/ccuser/workspace/learn-javascript-U2L1E5-8/main.js:8
} else if {
^
SyntaxError: Unexpected token {
at createScript (vm.js:53:10)
at Object.runInThisContext (vm.js:95:10)
at Module._compile (module.js:543:28)
at Object.Module._extensions…js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.runMain (module.js:605:10)
at run (bootstrap_node.js:427:7)
at startup (bootstrap_node.js:151:9)
What is going on here, and why is this not working? What is wrong with my code?
let moonPhase = 'mostly full';
if (moonPhase === 'full') {
console.log('Howl!');
} else if (moonPhase === 'mostly full') {
console.log('Arms and legs are getting hairier');
} else if (moonPhase === 'mostly new') {
console.log('Back on two feet');
} else if {
console.log('I swear I am not a werewolf.');
} else {
console.log('Invalid moon phase');
}
Thank you very much! I can not believe I was that blind. Thanks for the quick and helpful response!
And no, it did not. It gave me code from exercise 6/11, which was unneeded.
I actually haven’t done this new ES6 JS course up until just now, rushing up to the part of your question, good catch, the exercise only requires two else if statements.
I was pointing out why you caught the error because lacking a condition if you put a else if based on your code.