It looks like sleepCheck() isn't returning


#1

Hi guys
Well in my case it shows the message:
"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."

But i´ve already used the code in the chrome console and works fine

My code is:
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);

Can´t see to find what´s wrong...


12 function/else ....it is driving me crazy
#2

The apostrophe you use in "you're" looks like a different character than the one the instructions wish you to use


#3

Thank's biff75!
Yes, misspelled it for the acute accent
Thank´s again!


#4

Same is the issue even I am facing, the apostrophe is same as the instructions' wish.
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);

I am stuck , how do I proceed?


#5

Have you tried refreshing the browser? Does it work in a different browser?


#6

I finally figured out what was wrong in this, in my code
if(numHours>=8){
return "You're getting plenty of sleep! Maybe even
too much!";
}
so i had indented in the part 'too much!";'
After i removed that it is working fine. Thanks


#7

Glad you solved it. The text has to exactly match the one provided in the instructions or you won't get passed to the next. Keep this in mind as you progress :slight_smile:


#8

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