Lesson 12 problems if/else


#1

var sleepCheck=function(numHours)// Write your function below.

{if(numHours>=8);

{return "You're getting plenty of sleep! Maybe even too much!";
};
else {
return "Get some more shut eye!";
};
}
// Don't forget to call your function!
sleepCheck(10);
sleepCheck(5);
sleepCheck(8);

SyntaxError: Unexpected token else

I don`t understand why "else" is unexpected. Can anyone help me?
Thank you


#2

you have too many semi-colons. for example here:

if(numHours>=8);

that will make the if statement never execute properly. and the closing curly bracket (}) of if and else you also don't need semi-colons


#3

The function runs fine and give the information requested, but it is still being marked as incorrect. Any suggestion from the coding gods out there?

// Write your function below.
// Don't forget to call your function!
var sleepCheck = function(numHours) {
if (numHours >= 8) {
return"You're gettings plenty of sleep! Maybe even too much!";
}
else {
return"Get some more shut eye!";
}
};
//Calling funtion
console.log(sleepCheck(10));


#4

the string returned should be an exact match, you have gettings instead of getting. Just copy the string from the instructions, not the most important part of the exercise