12. Functions & if/else Return Error


#1

I keep getting this error:

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're getting plenty of sleep! Maybe even too much";
    }
    
    else 
    {
        return "Get some more shut eye!";
    }
};
sleepCheck(10);


I don't know what I am doing wrong. Please help!


#2

Compare your string to the above. They must match exactly.


#3

You are so close to being right


#5

Haha! Thank you. I feel silly now. Why is it always one character off? :stuck_out_tongue:


#6

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