12/13


#1

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

//console.log(sleepCheck(10));
sleepCheck(10);
sleepCheck(5);
sleepCheck(8);

Cant figure out whats wrong with my code.


#2

This is wrong. Else does not like conditions, only "if" and "else if" likes conditions. Else takes in everything else you did not cover with the previous "if"/"else if" conditions.


#3

First of all, don't have a condition in the Else part of your code, as else is used to cover anything that doesn't meet the condition set in if. Second of all, change these

 console.log("You're getting plenty of sleep! Maybe even too much!");
 console.log ("Get some more shut eye!");

Into this
return("You're getting plenty of sleep! Maybe even too much!");
return("Get some more shut eye!");

now, just change the ending bits to be
console.log(sleepCheck(5)) instead of just sleepCheck, and it should work.