Lesson 12- Or / More on Control Flow in JS (I don't know what's wrong)


#1



When I submit the code it says, "It looks like your function doesn't return true when tired is true and bored is false." I don't know what I'm doing wrong.
var tired = true;
var bored = false;

var nap = function(tired, bored) {
  if (tired || bored)
    {return true;}
  else
    {return false;} 
};

nap(tired, bored);


#2

@twopunks

Instead of testing with the || or operator, try with the && and


#3

The whole lesson is about using the or operator


#4

HI I just read the instruction of the lesson your function dont need of the argument tired and bored just remove them.


#5

Oh, that worked! Thanks!


#6

Pls ckeck my code. What is wrong? It says me "Make sure to set bored to the opposite of tired (that is, if tired is true, bored should be false)".

// Declare your variables here!
var tired = true;
var bored = true;

var nap = function() {
// Add your if/else statement here!
if (tired || bored) {return true;}
else if (tired || !bored) {return true;}
else if (!tired || bored) {return true;}
else {return false;}
};


#7

You set both var tired and var bored to true. It says in the instructions that one should be set to true and one should be set to false.