I am learning JavaScript on codeacademy and I came upon an error as I was doing a lesson and I could not figure out how to fix it. The error was
SyntaxError: Unexpected token else.
Here is my code:
sleepCheck = function (numHours) {
if (sleepCheck >= 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 was supposed to be a sleep checker. I was learning about functions and the return keyword.