Js function if/else #12


#1

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

Currently getting SyntaxError: Unexpected token else
not sure where I went wrong....


#2

There is a semi-colon before else that needs to be removed. We never write a semi-colon before else.


#3

Also not only you have mistake on else clause but ,also in if clause which have semicolon in it and remove extra parentheses and curly bracket.


#4

And return needs a + b


#5

And return is supposed to be a + b


#6

Sorry it came out twice, my apologies