SyntaxError: Unexpected end of input


#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!";
}

console.log (sleepCheck (10));

what am i doing wrong? error message says Syntax Error. Unexpected end of input


#2

Simple typing error, you haven't closed off your function block with }; after you closed your if else statements. This is one of the reasons its a good idea to practice indenting your code to make it easier to see where code blocks start and finish.
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!";
}
}; // <---- this is missing
console.log (sleepCheck (10));