Help! Keep receiving "Syntax Error:Unexpected Token {" when calling sleepCheck function


#1

I've checked the syntax several times and still seem to be getting this error message - possible about an extra curly bracket? Any help is appreciated. Thanks.

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


#2

You have a condition on else where you shouldn't have one.


#3

Ok @ainsleighb else is not suppose to have a conditon. This is how the conditons go..

if (This Happenes(Evaluates to true)){
//Do This....
}
else{
//Do that
}

So just erase the conditon of else statements. Docs about conditonal statements is here (for more info). Hope this helped!


#4

Just an issue of "trying to make things more complicated than they actually are". Thanks!