12. Functions & if / else - only prints once, but no error code


#1



Codecademy lets me move on to the next lesson, but the console only prints "You're getting plenty of sleep! Maybe even too much!" once. I'm going to assume it printed for the first input of 10, but not the other two. Where did I mess up?


var sleepCheck = function(numHours) {
    if (numHours >= 8) {
        return "You're getting plenty of sleep! Maybe even too much!";
    }
    else
    {
        return "Get some more shut eye!";
    }
}
sleepCheck(10);
sleepCheck(5);
sleepCheck(8);


#2

the console logs the value to the console by default, if you want to log more to the console use console.log()


#3

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