Functions and if I else


#1


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

It's saying that my code doesn't return "Get some more shut eye!" When numHours is 5. However, it is returning this. I don't know why it thinks it isn't.

Replace this line with your code. 
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);
         */ 
         console.log(sleepCheck(10));
         console.log(sleepCheck(5));
         console.log(sleepCheck(8));
         console.log(sleepCheck(4));


#2

Your else return statement ends with a period. Change it to an exclamation point and you should pass.


#3

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