SleepCheck says not returning but it is in console


#1



Functions if/else


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.


var sleepCheck = function(numhours) {
    if (numhours >= 8) {
 return 'You are getting plenty of sleep! Maybe too much!';
 } 
 else {
     return 'Get some more shut eye!';
 }
};
 
sleepCheck(10);
sleepCheck(8);
sleepCheck(5);


#2

strings returned should be an exact match. In your case even is missing in maybe even too much, maybe there is more. Just make sure it is in exact match


#3

As @stetim94 said:

In a real world application this doesn't usually matter, but the course checks the output exactly so sometimes its easy to get messed up on spelling/grammar discrepancies.


#4

Thanks Levi. It works now. The strings weren't exact. ALSO because I used ' ' (apostrophe) for my string instead of " " (quotation marks) it caused and error because of the you're. The apostrophe was flagged as an unexpected identifier. Something for me to keep in mind because I like to use apostrophes instead of quotation. Also I tried it in Google Chrome Console and it had worked fine but since Codecademy wants exact string I had to do it over.