3/30. Literaly speaking - French version of the course - where is the bug?


#1


https://www.codecademy.com/fr/courses/javascript-beginner-fr-FR-y2vdo/0/3?curriculum_id=5355c2b7516bcbd912000008


Hello, I'm a french user of Codecademy. All the courses have been translate and thanks to the people who've done the job. It's great. Here's my problem:
My code seems correct. I obtain correct answers in the console. But I have the following warning popup: "Oops, try again. It looks like your speak method doesn't properly take in a single argument and output the correct string."

In french (for french speaking users :wink:) the message is "Oups, merci de réessayer. On dirait que votre méthode 'parle' ne prend pas correctement un argument pour afficher la bonne chaîne de caractères."

The tricky part is that in the french version of this exercise, the instructions tells us to print sentences not finishing with the valor of "mood" proposed in 'jules.speak()' at the end of the code. The instruction ask us to print the seneces "Salut,
je me sens très bien" instead of "Salut, je me sens super" and "Salut, je ne me sens pas trop mal" instead of "Salut,
je me sens pas mal". So that the shorter solution: console.log("common part of the sentence" + " " + mood) can't be used without altering the valors in "jules.speak()".

Nevertheless, I've tried the shorter solution.

...

var jules = {
job: "developpeur",
fiance: false,
parle: function (humeur) {
console.log("Salut, je me
sens" + " " + humeur);
}
};

jules.parle("très bien");
jules.parle("pas trop mal");

...

It works in the console but I obtain the warning popup "Oops, try again. It looks like your speak method doesn't properly take in a single argument and output the correct string."

Same thing when I use the longer code below:


var jules = {
    job: "developpeur",
    fiance: false,
    parle: function (humeur) {
        switch (humeur) {
            case "super":
                console.log("Salut,
je me sens très bien");
                break;
            case "pas mal":
                console.log("Salut,
je ne me sens pas trop mal");
                break;
            default:
            console.log("Salut, ça
va si mal que ça?");
            break;
        }
    }
};

jules.parle("super");
jules.parle("pas mal");


#2

It could be a case where the SCT is not expecting a switch statement, and is looking for an if statement.

    parle: function (humeur) {
        if (humeur==="super") {
            console.log("Salut, je me sens très bien");
        } else {
            console.log("Salut, je me sens pas trop mal");
        }
    }

#3

Thanks a lot, you were absolutely right. So my code was right but not what was expected... It's a relief :slight_smile:


#4

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