12# SyntaxError: Unexpected token if


#1

I don't understand what is wrong :tired_face:

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

console.log (sleepCheck (10) )
console.log (sleepCheck (5) )
console.log (sleepCheck (8) )


#2

You forgot the curly braces surrounding your function.

Example:

var abc = function(arg) { //Here


} //Here

#3

something is still wrong, do you know what else?


#4

Both strings need the be the exact same as given in the instructions.

if I recall from memory You're needs to be capitalised.


#5

it says SyntaxError : unexpected token if :confused:


#6

repost your whole code


#7

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) )
console.log (sleepCheck (5) )
console.log (sleepCheck (8) )


#8

remove the } before your if because you're just closing the function there. and place it:


#9

thanks guys that worked :relieved: