Stuck in OR operation, I don't know what is wrong with this code


#1

Hello everyone below is my code i don't know what is wrong in it. I used alert to check the value of tired variable but its showing false in nap function. Can anybody help with this?

// Declare your variables here!

var tired = true;
var bored = false;

var nap = function() {
// Add your if/else statement here!
alert('>>'+tired);

if(tired || bored)
{
console.log("take a nap");
}
else
{
console.log("Continue working!!");
}
};


#2

exactly which exercise is this? I would make a function call at the end:

nap()

otherwise, your function doesn't get executed. Currently the if condition is true, take a nap is printed to the console


#3

Thanks. when i called the nap() function it works!!