Functions Q.12


I am on Question 12 on functions and keeping getting Syntax errors for numHours(10), can someone help me out?

// Write your function below. 
// Don't forget to call your function!

var sleepCheck = function(numHours){
    if (numHours >= 8){
        return "You're getting plenty of sleep, maybe even too much!";
        return "Get some more shut eye!";





Can I have the link?
And your error message?


You miss quoted the first return statement. Should be of sleep! Maybe instead of what you have. Just copy and paste from the instructions into what you have for maximum efficiency when having to type out exact wording and punctuation in these lessons.

Also link:

And this is the official error 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. @kyleaw

Also I assume the period right there is a mistake as well.


You're the real MVP. :slight_smile:
I probably could have found it, I just would rather not dig haha.
Thank you for having all the answers!


Haha silly me, cheers mate sorted it.


No problem! Sometimes its the little things that getcha the worst xD Happy coding! :smiley:


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