12. Functions & if / els Returning Error


#1


https://www.codecademy.com/courses/javascript-beginner-en-6LzGd/2/4?curriculum_id=506324b3a7dffd00020bf661#


When I run my code I get this message:
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 planty of sleep! Maybe even too much!";    
    }
    else {
        return "Get some more shut eye!";
    }
};

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

//console.log(sleepCheck(10));      This also doesn't work
//console.log(sleepCheck(5));
//console.log(sleepCheck(8));


#2

the string returned should be an exact match, copy paste it from the instructions


#3

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