Learn JavaScript


#1

var moonPhase = 'full';
if (moonPhase===full) { console.Log('Howwwwwlll!!');}
else (moonPhase!==full);{
console.Log('I swear I am not a werewolf...');}

wont let me run because of a ) after the else (moonphase!==full) and keeps telling me that it expects an assignment or function instead of a parenthesis but when i take out the parenthesis and try to put something else it expects there to be a close to the opening parenthesis on the third line, anyone help?


#3

Are you seeing any error messages? Maybe something similar to: ReferenceError: full is not defined?

  1. In two different places you have referenced a variable named full, which doesn't exist, when you meant to reference a string called "full". You will need to fix those.
  2. JavaScript is case sensitive so console.log and console.Log are not the same. You will need to use the correct one.
  3. You have also ended your if/else statement too soon by putting a ; after else (moonPhase!==full);

Sort those items out and let us now how you get on.


#4

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