Unexpected token?


#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!";
};
sleepCheck("5")

i got "unexpected token if"


#2

var sleepCheck= function (numHours)
var sleepCheck= function (numHours) {

}


#3

i now got unexpected token =


#4

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


#5

You have to pass int 5 not string "5"


#6

The unexpected token = is because of this

needs to be numHours >=8

also at the end you need to call sleepCheck on 10 hours, 8 hours and 5 hours.


#7

Ok summary of errors in OPs code: