12. Functions & if / else


#1

Hi everyone, I kindly ask for your help since I cannot figure out the mistakes I'm making.

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

It says: > 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.


#2

HI first this part

if ("numHours" >= 8)

you should remove the " " around numHours because it make it a string, but you want to use the argument numHours

then the string you are returning is

return "You are getting plenty of sleep! Maybe even too much!";

and they want you to return

return "You're getting plenty of sleep! Maybe even too much!";

#3

Oh right! Thank you! :smiley: