Where is the wrong part?!


#1

// 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!";

            };

};

var val = sleepCheck( 10 );
console.log( val );
var val = sleepCheck( 5 );
console.log( val );
var val = sleepCheck( 8 );
console.log( val );

#2

Hey @youssefhouse im preety sure your just suppose to call it straight up without initating a variable so like this:

 console.log(sleepCheck(10))

#3

Not Work!!! ... i don't know why?!

the code is working!!!


#4

The semicolon after else is not necessary and the strings need to match with the instruction so the extended space after "Maybe" might be the problem. What is the error message about it? If there is a typo in one of the output messages the error might give you a hint where to search for. And last but not least you only need var on the first use of a variable (declaration) and as @amanuel2 mentioned you could as well do it without the val variable.


#5

change your if ( numHours <= 8 )
to (numHours >= 8 )


#6

Oh yes that makes sense as well. But maybe have a look at @amanuel2's link about formatting because using <> is not how it works rather backticks or the </> button.


#7

Thnx All

i fixed it!