12 or operator is false but should be true


The code returns false.

Why is it not returning true, since one or both of the variables 'tired' and 'bored' are true? When I set tired=false and bored =true, it returns true.

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

var nap = function(input) {
  if(tired || bored){
     return true;
      return false;


because you just declared your function.you didnt call it.without calling the function will not work.

call it after closing the function.like

nap() // called with function name

or inside of console.log


and the result (false) you are getting it was just the last value(bored = false;) you added .


Thanks. I was very tired.


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