3/12 SyntaxError: expected expression, got keyword 'else'


#1

I don't really know how to fix this, the error is SyntaxError: expected expression, got keyword 'else'
This is my code. I don't know what's the problem with else being here...
// 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");
};
};
console.log(sleepCheck(10));


#2

Removed ; after calling the function. No effect.


#3


This should explain where the semicolons should be removed. If you still have questions about it feel free to ask.


#4

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

adding semi colons is like telling your computer "stop hold up a second lemme finish this line first then go on to the next one." You can't just tell the computer to "hold up" in the middle of a function (in most cases) and the if function is no exception! I took out the semi colons in the marked areas and the code ran fine~