Functions IF/ELSE


IS it a bug ?
I can't win this exercise , it's the syntax :

var verifSommeil = function(nombreHeures) {
    if (8 >=) {
        return "Vous dormez beaucoup ! Même peut-être trop !";
    else {
        return "Faites donc une p'tite sieste !";

Unexpected token )

Link :

Thanks !


your if comparison:

if (8 >=)

8 greater or equal then what? you should compare 8 with something, take a second to think what this might be


Thank you , but now , my problem is :
Looks like 'verifSommeil ()' does not return "You sleep a lot! Even perhaps too!" when nombreHeures is 10. Check your syntax if / else and if you use the proper comparison operator


this is seriously impossible, i even copied the string from the checking script, let me ask the other moderators


It's not very important , the most important is that I understood.

(Google Translate)


Well, i can tell you that you understand it.

But now every time you want to resume where you left off, you get set back to this exercise, kind of annoying


i missed something crucial:

if (8 >= nombreHeures)

the comparison is the wrong way around, this is for less then 8 hours, it should be the other way around:

if (nombreHeures >= 8)

since you want for 8 hours or more


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.