12. Functions & if / else


#1


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


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.


// Write your function below. 
// Don't forget to call your function!
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);
sleepCheck(5);
sleepCheck(8);


#2

Leading whitespace that is not expected may be the concern.


#3

This is going to annoy you but you need to return the exact string "You're getting plenty of sleep! Maybe even too much!" .You have a space before the first letter.


#4

that was the problem got it
thank you


#5

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