One output but 3 function calls


It works but it says "You're getting plenty of sleep! Maybe even too much!" when I called the function three times. There is only one result and at the bottom I did sleepCheck(5);. 5 is less than 8. Plz help.

// Write your function below. 
// Don't forget to call your function!
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!";


12. Functions & if / else issue
12. Functions if/else problems

I moved your question to a separate topic because it has a different question. From what I can see you're not using any output function like console.log. So what you see is the default console output which echoes the last value that occurs in the code which is in your case the value of this function call


which has a value of the returned value:

"You're getting plenty of sleep! Maybe even too much!";

So in order to see the other two as well you need to wrap them all in console.log statements:


and so on. Hope this makes it clearer.


Thanks! It let me move on.