12. Functions & If/Else


#1

I don't know what I am doing wrong! I keep getting an unexpected token error! Please help and thank you! :slightly_smiling:

var sleepCheck = funtion(numHours) {

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


#2

check for spelling errors


#3

Is there anything else that could possibly be wrong? I fixed my spelling error, but I'm still getting, "It looks like sleep check() isn't returning "You're getting plenty of sleep! Maybe too much!" when numHours is 10. Check your if/else syntax and whether you're using the correct comparison operator.


#4

copy the string that you are supposed to return exactly as they gave it


#5

"You're getting plentry of sleep!"
Check spelling again :slightly_smiling:


#6

This should work! Check for speling mistakes even in messages which are returned and use their definitions!
P.S. I suppose it wasn't really good idea to link even definitions to check speling=)

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(8);
sleepCheck(5);


#7

hello,

It doesn't work ! Where can i report this anomally ?


#8

This is the code I came up with and it passed fine. Hope this helps

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