Syntax error on JS functions lesson 12


#1


Help! Can anyone please tell me what I did wrong? It keeps saying that "SyntaxError: Unexpected identifier"


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(5);
sleepCheck(8);


#2

Wrap this condition in parentheses,


#3

Oh I also noticed "var sleepcheck" should be "var sleepCheck", works fine after correction! Thank you so much!


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.