Functions IF/ELSE


#1

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

ERROR :
Unexpected token )

Link :
https://www.codecademy.com/fr/courses/javascript-beginner-fr-FR-rpcse/2/4?curriculum_id=5355c2b7516bcbd912000008

Thanks !


#2

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


#3

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


#4

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


#5

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

(Google Translate)


#6

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


#7

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


#8

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