3. Literally speaking


#1



https://www.codecademy.com/courses/objects-ii/0/3?curriculum_id=506324b3a7dffd00020bf661


I think i have done everything correctly, but codecademy says ''Oops, try again. It looks like your speak method doesn't properly take in a single argument and output the correct string.'', even if i get what i should be getting in the console.


var james = {
    job: "programmer",
    married: false,
    speak: function(mood) {
        console.log("Hello, i am feeling" + " " + mood)
    }
};

james.speak("great");
james.speak("just okay");

this is what the task says: ''Take a look at the partially-defined james object. Complete the speak method such that the last two lines in the editor will cause "Hello, I am feeling great" and "Hello, I am feeling just okay" to be printed to the console.''
This is exactly what i get in the console:
Hello, i am feeling great
Hello, i am feeling just okay


#2

@aco314

Shouldn't it be a capital i ?


#3

I tested this on the lesson, as I was also having a very similar issue and this seems to be the only error in OPs code.

Its a good reminder that attention to detail in JS can be the difference between a 60 second line of code and 15 minutes of debugging!

edit: as my friend, who is a programmer for GM told me when I was complaining about some of the restrictive things CA places on their lessons (code not passing because of capitals, etc.); "you've learned a very important lesson about programming! Sometimes you can do everything "correct" and still not meet the clients required needs."

I've since learned to embrace these restrictions, even when they take me 20 minutes to realize i didn't capitalize a letter D:


#4

I still get an error for it , code :
var james = {
job: "programmer",
married: false,
speak: function(mood) {
console.log("Hello, I am feeling great" + " " + mood);
}
};

james.speak("great");
james.speak("just okay");


#5

console.log("Hello, I am feeling " + mood);


#6

It still did not work and i can't imagine why it makes a diference


#7

Well, below code works to me.

var james = {
job: "programmer",
married: false,
speak: function(mood) {
console.log("Hello, I am feeling " + mood);
}
};

james.speak("great");
james.speak("just okay");


#8

Oh my god i am blind . Thank you :smiley:


#9

var james = {
job: "programmer",
married: false,
speak: function(mood) {
console.log("Hello, I am feeling "+mood);

}

};

james.speak("great");
james.speak("just okay");

//don't push extra blank