Working on OR ex.12


#1


https://www.codecademy.com/en/courses/javascript-beginner-en-qDwp0/2/3?curriculum_id=506324b3a7dffd00020bf661


SyntaxError: Invalid or unexpected token


var tired = true;
var bored = false;

var nap = function() {
  if(tired && bored) 
  console.log("you don't need to take a nap necessrily);
  }
  else if(!(tired || bored)) {
      ("you are fine just chill.");
  }
  
  else {
      console.log("lets go out for drinks");
  
};


#2

HI this line

 console.log("you don't need to take a nap necessrily);

you didn't close the "


#3

thanks!
now I get:
SyntaxError: Unexpected identifier
as an error!


#4

you dind't close the nap function

var nap  = function() {

};

#5

yes i did take a look:
var nap = function() {
if(tired && bored);
console.log("you don't need to take a nap necessrily");
}
else if(tired || bored) {
console.log("you are fine just chill.");
}

else {
console.log("lets go out for drinks");

};


#6

YOu didn't

var nap = function() {
    if(tired && bored);
        console.log("you don't need to take a nap necessrily");
    }
    else if(tired || bored) {
        console.log("you are fine just chill.");
    }
    else {
        console.log("lets go out for drinks");
    };
}; #it's was missing this one

then you didn't open the if statement {.....and this line remove the ; at the end

if(tired && bored); <--

#7

ahh! thank you for that.


#8

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