Bug in "Introduction to Javascript, Control Flow step 5/9"?


#1


https://www.codecademy.com/en/courses/learn-javascript/lessons/control-flow/exercises/else-if?action=resume

on step 5/9, Instruction 4 doesn't want to move along even if I followed it literally, I set moonPhase to "solar eclipse" and hit "Run" and I see "Caution, unknown!" in the console, but the instruction doesn't move to step 5


var moonPhase = 'solar eclipse';
if (moonPhase === 'full') {
  console.log ('Howwwwlll!!!');
} 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 {
  console.log('Caution!');
}


#2

Guys, I figured it out, I deleted a semicolon on line 1 after (var moonPhase = "solar eclipse") and hit "Run" and it worked, I think it's a real bug because a semicolon is necessary there, right ?


#3

Hmm yes, you should have a semi-colon there. But javascript isn't really that fussy about if you have one or not.

If you want to look into the nuances of it you can read this.


#4

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