sleepCheck()


#1

I get this error: "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." On this part of the lesson: https://www.codecademy.com/courses/javascript-beginner-en-6LzGd/2/4?curriculum_id=506324b3a7dffd00020bf661

// Write your function below. 
// Don't forget to call your function!
function sleepCheck(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 can see all the messages in the console


#2

Remove the backslash in you're. When you use apostrophes in your text strings, you have to put the entire text inside quotation marks to avoid syntax errors.


#3

They probably haven't factored in escaping as part of a possible solution, so you can't use it in this exercise.

But brownie point to you and keep up the good work!


#4

I had it with double quotes first, and it didn't work. Tried single quotes, didn't work. Went back to double quotes still doesn't pass. But I'm getting all the messages correctly in the console. You don't see anything else? cause I don't.


#5

Thanks, but the backslash isn't the problem. I tried it with double quotes first, then single.


#6

even i am facing the same problem


#7

You didn't add an exclaimation mark to the end of "much".


#8

I'm also facing the similar problem here, take a look at my codes, I really don't know what the problem is. And if I remove the '{' from the 'return' statement I then get the error about the 'else' token. I'm really confused. I've tried in anyway but nix.

var sleepCheck = functions (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);

#9

Add an exclamation point after "too much", refresh the page and submit.


#10

You're a star buddy, thanks so much! It worked this time.


#12