Why is this code logging to console 3 times?


#1


Why does this code return the console.log message 3 times?


The code works just fine, but I'm trying to learn, ya know.


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


var nap = function() {
    if(tired||bored){
        console.log("that is sad")
        return true
    }
    else{
        return false
    }
  // Add your if/else statement here!
  
};


#2

There's a great discussion on this here:

I suspect you're having a similar issue with the SCT of the codecademy learning environment. You can always use a site like https://repl.it to double check your code. Hope this helps :slight_smile:


#3

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