Where did I go wrong on this one?


#1

https://www.codecademy.com/courses/javascript-beginner-en-6LzGd/2/4?curriculum_id=506324b3a7dffd00020bf661#

Hey guys, I'm getting the correct answers displayed in the console. My console displays this when I submit the code :

"You're getting plenty of sleep ! Maybe even too much!
Get some more shut eye!
You're getting plenty of sleep ! Maybe even too much!"

Which seems to be the right answers for each value however when I submit and send the code I get this exact error message (not in the console, but at the bottom of the page) :

" 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. "

It seems really weird cause the console is actually displaying the correct answer so I see no issue there.

Here the code I made for this exercise

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));

Any help on what I did wrong ? I can't really see the error on my syntax. I'm very new so if you could ELI5 that would be awesome !

Thanks for your time!


#2

Ok nevermind, I found it. There was an unecessary space between sleep and the ! mark.

Sorry about the useless post, should've thought about this a bit more.


#3

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