Functions for 12/13


#1

Hello, i am inputing this code and it says unexpected token if when i submit it. Can anyone help me?
The code:
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!";
}
sleepCheck(10)
sleepCheck(5)
sleepCheck(8)


#2

on this line

var sleepCheck = function (numHours)

you forgot to open the function like this

var sleepCheck = function (numHours){

and you have to add one }; after these lines

else {
return "Get some more shut eye!";
}

#3

var sleepCheck = function (numHours) //Put an open bracket at the end of this line

You're using a function, so use an open and closing brackets around your if and else statements.


#4

// 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! Maybe even too much!";
} else {
return "Get some more shut eye!";
}
};
sleepCheck(10);
sleepCheck(5);
sleepCheck(8);

This works.


#5

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

It's still showing me an error Oops, try again. It looks like your function doesn't return "Get some more shut eye!" when numHours is 5. I don't understand...
please help!


#6

sorry Problem solved... eye instead of eyes....


#7

Are ok, thank you very much!


#8

Make Sure you spell everything correctly because my problem
that kept me from advancing was that i forgot to capitalize the Y in youre