I'm trying the 12th exercise of introduction but it is showing error


#1

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


#2

@ankithota,

You should use the exact text

-02. Inside the function, write an if statement where if the number of hours of sleep is greater than or equal to 8, the computer will
return "You're getting plenty of sleep! Maybe even too much!";.
-03. Otherwise (else) if the number of hours of sleep is less than 8, have the computer
return "Get some more shut eye!";


#3

I think you miss a semicolon at the return lines. It's should look like this
*** return"bla bla bla";}


#4

Thanks for your suggestion


#5

No semicolon after the else } and probably a typo in the output messages. First guess would be an additional space between eye and ! but maybe just copy and paste the string from the instruction or the error message. Anyway the syntay seems to be ok.


#6

I have the same problem

And this is my error "SyntaxError: Unexpected token else"


#7

@chipslayer87737,

For Javascript a semicolon
is an End of Statement indicator.

You are using this semicolon at the end of the 'IF' condition
and therefor the ELSE is not expected.

Para Javascript punto y coma
es un indicador de fin de Declaración.

Usted está usando este punto y coma al final de la 'IF' condición
y por lo tanto no se espera que el ELSE.