12. Syntax Error


I think I'm being really stupid but I can't work out what my syntax error is, it says its an unexpected token (


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


Depending on your background this might not look straightforward - What you're trying to do is define a function. This is achieved with the function keyword. var is mostly used for variables. Change your var into function :wink:


Hi you should declare your function like that

var sleepCheck = function() {
 #here go your if  and else statement 


Thanks, as soon as you said that it stuck out like a sore thumb! Nightmare! :slight_smile: