Functions Q.12


#1

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!";
    }
    else{
        return "Get some more shut eye!";
    }
}

sleepCheck(10);
sleepCheck(5);
sleepCheck(8);.

Cheers

`


#2

Can I have the link?
And your error message?


#3

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: https://www.codecademy.com/en/courses/javascript-beginner-en-6LzGd/2/4?curriculum_id=506324b3a7dffd00020bf661

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.


#4

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!


#5

Haha silly me, cheers mate sorted it.


#6

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


#7

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