Functions/If else


#1

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>

<In what way does your code behave incorrectly? Include ALL error messages.>

``` // It keeps returning SyntaxError var sleepCheck = function(numHours) { if numhours > 8{ return("You're getting plenty of sleep, maybe even too much"); }; else{ return("You need to get some sleep"); }; }; numHour = 5 numHour = 9
<do not remove the three backticks above>

#2

should be inside (), like so if (numHour > 8) {}

if (condition) {
block of code to be executed if the condition is true
} else {
block of code to be executed if the condition is false
}

there are no semicolons inside if/else block.

and you are using

it should be one and the same name

and if you want to call the function with this var [quote=“webjumper23206, post:1, topic:35841”]

numHour = 9
[/quote]

write it like so sleepCheck(numHour);

and to be safe define it like this var numHour = 9;


#3

Thank You!!I have been trying to figure that out for like an hour


#4

You are welcome

I sent you a PM with jsBin example of sth similar.

It works but it is not the solution to this lesson