12.Function 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.>
What should I do ?


var sleepCheck = function(numHours) {
if ( sleepCheck >= 8 )
{ return "You're getting plenty of sleep! Maybe even too much!";}

else

{ return "Get some more shut eye!"; }
};
sleepCheck(10);
sleepCheck(8);
sleepCheck(5);


#2

Line 4: replace sleepCheck with “numHours”. You want to check if your parameter is >= 8
Line10: You don’t need a “;”


#3

fix the curly brackets


#4

Oh I got it. Thank you ! :slight_smile:


#5

Correct about the numHours part but the semicolon on Line 10 is fine, that belongs to the end of the function:

var name = value;

and in this case value is function(...){...}.

@gigarunner55716 What is wrong about them? A little bit unformatted but they all match as far as I can see.