Functions and if/else


#1

What's wrong with this???

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


#2

Add a space between the "!" and "Maybe" in your first return statement. And make sure you spell "plenty" right.


#3

remove var before defining function


#4

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