Functions & if/else


function sleepCheck(numHours){
if (numHours>=8);
    return "You're getting plenty of sleep! Maybe even too much!";
    return "Get some more shut eye!";

// it tells me "expected an identifier and instead saw "else" & "missing semicolon"


take a good look at your curly brackets. after your if condition you have semi-colon, this should be a opening curly bracket

once you add this curly bracket, don't forget to close your function


thanks!! helped a lot


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