SyntaxError: Unexpected keyword 'else'


#1



Whats wrong here?
SyntaxError: Unexpected keyword 'else' --> This is my error message
This is my code:


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!";
    }
};
    sleepCheck(10);
    sleepCheck(5);
    sleepCheck(8);


#2

this line:

if(numHours >=8);

the semi-colon prevents the if condition from executing properly, remove the semi-colon


#3

Thanks ! it worked :grin: