Functions & if / else ? whats wrong?!


#1
<img src="//codecademy-discourse.s3.amazonaws.com/original/4X/a/a/8/aa858ba4205b59cfcfaede53b5ff7c0d87157668.png" width="690" height="431">indent preformatted text by 4 spaces

#2

@atefelshamy,

-1

For the =Javascript Interpreter= a semi-colon-; is an End-of-Statement indicator.
Do NOT use a semi-colon-; in your IF ELSE Statement-structure.

if (condition ) {
   //IF code-block
}
else {
   //ELSE code-block
}

-2

Your sleepCheck function

var sleepCheck = function( numHours ) {
     //Begin of FUNCTION-BODY
     // anonymous function takes 1 PARAMETER =numHours=
     //this =numHours= PARAMETER is used 
     //as a =local= VARIABLE
     //throughout the FUNCTION-BODY

     //your code, for instance an IF ELSE statement-structure

     //End of FUNCTION-BODY
    };

As you call the sleepCheck =function=
sleepCheck();
and this sleepCheck =function= has 1 parameter numHours
you will have to provide 1 argument
in our case a number Value like 10
sleepCheck(10);

some quotes from the outer-world:

argument is the value/variable/reference being passed in,
parameter is the receiving variable used within the function/block**

OR

"parameters" are called "formal parameters",
while "arguments" are called "actual parameters".**


#3

// Write your function below.
// Don't forget to call your function!

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