Unexpected token: return


#1


Help


8 Functions if/else Confusion!
#2

@microace01843,

An IF ELSE statement

if ( condition ) {
    //IF code-block
}
else {
   //ELSE code-block
}

As you can see an ELSE does NOT take a condition.

For code-convention
please have a look at
http://javascript.crockford.com/code.html


#3

corrected below:

// Write your function below.
// Don't forget to call your function!

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

sleepCheck(10);
// sleepCheck(5);
// sleepCheck(8);