I have no idea what I'm doing wrong


#1

I'm on Introduction to functions and the tutorial wants me to create a function called sleepCheck and make its parameter numHours. Inside that function it says to make an if/else statement that returns "You're getting plenty of sleep! Maybe even too much!" if sleepCheck is greater than or equal to 8. the else statement is supposed to say "Get some more shut eye!" it then told me to call the function with 10

here's my code:

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

i get the 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" and i have no idea what to do in order to fix it. Help please!


#2

It should be:
var sleepCheck = function (numHours) {
if (numHours >= 8) { <-------------------- Here's your mistake
return "You're getting plenty of sleep! Maybe even too much!";
} else {
return "Get some more shut eye!";
}
}
sleepCheck(10)

You're calling the function, and using the parameter to check. "10" is the value you're throwing into the function in place of numHours, to see how the if/else statement ends up when sleepCheck runs.
Hope I could help!!