My code works but I am getting error message


The code works perfectly. It prints the correct dialogue into console. However, i am getting this message and i can't continue the course:
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.

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



When we say call a function, we don't want to log it in the console. We want to call it. Like this:

functionName(optional parameter);


The spelling is off. You put "You are getting plenty of sleep!" when the question wants "You're getting plenty of sleep!"


That was also an error, not the one they were asking about, but still worth mentioning. Thank you.


It worked, thanks a lot! All these time i was busy looking for syntax error.....