Functions & if/else


#1

NEED HELP

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!";
}};
console.log(sleepCheck(10));
console.log(sleepCheck(5));
console.log(sleepCheck(8));

i get this below error msg but it prints out the answers right on console:

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.

whats wrong!!


#2

The syntax seems to be ok so it's most likely a typo in the output message copy and paste the messages if can't find it. A first guess would be the missing space between ! and Maybe.


#3

Are you not embarrassed by that typo?

Tut tut. :wink:


#4

:relaxed: psst :wink:


#5

A post was split to a new topic: What is wrong here