Why is this code logging to console 3 times?


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() {
        console.log("that is sad")
        return true
        return false
  // Add your if/else statement here!


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:


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