Unexpected token else


#1



https://www.codecademy.com/courses/javascript-beginner-en-6LzGd/2/4?curriculum_id=506324b3a7dffd00020bf661


I keep getting a syntax error Unexpected token else. Any ideas as to why?


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
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)

Do not include semi colons in your if and else statements. In the code above it has one only where it is needed.