My code looks correct but keep gettin error


My code looks identical to all the answers I've seen but it still doesn't pass me.

// Write your function below.
// Don't forget to call your function!
var sleepCheck = function(hours)
if(hours >= 8){
return"You're gettin plenty of sleep! Maybe even too much!";
return"Get some more shut eye!";

Oops, try again.
It looks like sleepCheck() isn't returning "You're getting plenty of
sleep! Maybe even too much!" when numHours is 10. Check your if / else
syntax and whether you're using the correct comparison operator.


The answer is in the error message:

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!";


Sorry guys I figured out I typed "gettin" instead of "getting". Shouldn't it return three results though. I only get the first result returned not the other two but it still passed me.


Your code (once corrected) is all that is expected. The output you are seeing is the response from the command line interpreter (since we are using the console). To view the actual output, log each call expression:



Ahhhhh....that makes perfect sense haha. So what I was actually seeing was the last result after it ran through all three. I just tested it. I get it now. Thanks man.