12 Functions & If?Else


#1

Error appears' 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."

Not sure whats wrong with the code, have checked on the forum and my code seems about the same. Any advice?


var sleepCheck = function(numHours)

{
    
if (sleepCheck >= 8)

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

else

{
    return"Get some more shut eye!";
    
}

sleepCheck(5);
sleepCheck(8);
sleepCheck(8);

}


#2

You need to call your function outside all closing brackets.


#3

and your if condition:

if (sleepCheck >= 8)

you check if the function equals or is greater then 8? I would compare with the numbers of hours i have to sleep (the function paremeter numHours)


#4

OH I see now. Didnt check the details ■■■■ it lol. Thanks alot.