Introduction to Objects II: Literally Speaking : Oops, try again


#1

Apparently the below code is wrong

Error is
Oops, try again. It looks like your speak method doesn't properly take in a single argument and output the correct string.

Instructions are:

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.

var james = {
job: "programmer",
married: false,
speak: function(mood) {

    console.log(mood)

}

};

james.speak("Hello, I am feeling great");
james.speak("Hello, I am feeling just okay");


#2

Any help would be appreciated


#3

Two things about functions that make them ideal for so many situations that we come up against repeatedly, such as this one. For instance, we can have the function handle all text that repeats each time, And we can hand the function a simple piece of data and it will handle that piece as unique, within the larger context of repeated string data.

    speak: function (mood) {
        console.log("Hello, I am feeling " + mood);
    }

and the call would be,

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

#4

@mtf
My code looks correct but it doesn't print to the console, though I get the okay to go to the next lesson.
Here it is, take a look.

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

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


#5

The code looks fine and does output to the console as expected. I have no explanation as to why you weren't seeing any output.