Question 12 in JS if/else statement


#1

What's wrong here please ?

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


#2

We can only pass one argument at a time as that is all the function takes (only one parameter).

sleepCheck(10);
sleepCheck(5);
sleepCheck(8);

#3

It is still refused with a syntax argument :"Oops, try again. There was a problem with your syntax. " and the result tab written :"SyntaxError: '{' attendu" . (attendu =expected)


#4

Do I have to add a "console.log()" statement after calling the function ?


#5

I'll need to check the lesson, but as I recall we don't have to log anything, just make the three calls. Please post your corrected code in a new reply. It would be nice if it is stretched out into a few lines, rather than scrunched up. Things are easier to read and space is cheap.


#6

I don't understand . what is wrong exactly ?


#7

Nothing that I can see once the call expressions are written correctly. That is why I asked if you could repost your code, this time with a little more white space.


#8

Yes you're right ! actually I did it like this because I was explained that sometimes it doesn't run if you don't write down exactly the instructions . That's why I copy-paste the different strings even all the code you can find in the instruction tab .
I m going to try white space