12/13 help


#1

// Write your function below.
// Don't forget to call your function!
var sleepCheck = funtion(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);

whats wrong with this


#2

Seems to be fine, did you try to refresh the page? Do you get an error message? Did you check the output messages for typos? Also if you don't find the typo copy and paste the expected string, this is really a very common error, so don't mind at least it is not your syntax.


#3

well it says SyntaxError: Unexpected token { so i really dont know
and i did copy and paste the return things


#4

Ok I completely missed this on the first look, but you wrote funtion instead of function.


#5

getting error:

Oops, try again.
It looks like sleepCheck() isn't returning "You're getting plenty of
sleep! Maybe even too much!" when numHours is 10. Check your if / else
syntax and whether you're using the correct comparison operator.

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

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

I don't understand what the problem is.


#6

@microcoder20513 Your problem at first glance is that you have a ";" attached to the closing "}" on your else statement Also in your if statement you have

instead of:

return  "You're getting plenty of sleep!! Maybe even too much"

hope this helps


#7

okay lol that was the problem thank you so much


#8

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);


#9

Thanks. I don't know how I didn't see that extra "r".


#10

A post was split to a new topic: 12/13 It looks like sleepCheck() isn't returning