Functions if and else


#1

Hey guys, I need help from some of you. I can't find the syntax error.

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));
console.log(sleepCheck (5));
console.log(sleepcheck (8));


#2

var sleepCheck = function (numHours) // here you need a opening { bracket

and close it after else statement


#3

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