Syntax error


#1

where is the error

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

#2

Thats not allowed in quotes. Fix that first because it's the function's 'value'

If statements are in ( )


#3

thank for the tip, but now it says unexpected token

´´´
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(10);
´´´


#4

Why are you only putting that in brackets? you need the whole if statement in there.

Also

You've just closed the function. change that to a { and remove the ;

then place another } before you call sleepCheck

This won't print anything to the console just an FYI unless you do
console.log(sleepCheck(10));


#5

Hey @wolf

This is the syntax for an if statement:

if(condition) {
//return something;
}
else{
//return something else;
}

at the end of your var you should put a semi colon ;


#6

Putting a semi-colon at the end of his var will stop it from working as you can see here

http://jsbin.com/novudajaso/edit?html,js,console,output

He needs to wrap the if statement inside the function


#7

yes sorry you need to put your function in curly brackets