12 Functions, IF & ELSE



What is wrong with my code? 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.

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


I changed the console.log's to return statments


Why is sleepCheck in your condition?

Step 2 of the instructions reads:

Inside the function, write an if
statement where if the number
of hours of sleep is greater than 
or equal to 8, the computer will 
return "You're getting plenty of sleep! 
Maybe even too much!";.

Make the necessary correction to your if condition :slight_smile:


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