Functions if/else...what's wrong?


#1


Functions if/else


It returns what it is supposed to with the specified parameter. Why is it telling me it's wrong?


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

console.log(sleepCheck(10));


#2

the string returned should be an exact match, copy it from the instructions. The error message indicate your string isn't a perfect match (maybe too much spaces somewhere, or another small detail)


#3

Hi!
:grinning:
I think there's nothing wrong with your code. You just didn't complete the whole task. You're asked to call the function three times. With parameters of 10, 5 and 8.


#5

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