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


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



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)


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.


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