3.Literally Speaking


#1


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


The code is displaying in the console as it should:
Hello, I am feeling great / Hello, I am feeling just okay,
Yet I am getting this error message: It looks like your speak method doesn't properly take in a single argument and output the correct string.

Here is my code:

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

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


Why am I getting this error message?


#2

i think you need to use + to join the string and variable together


#3

It worked, but why do u need to do that?


#4

it has to do with how the validation works, do i need to get into details?


#5

Yes please (thankyou)


#6

looking at the validition:

if (loggedFromSpeak[0] !== "Hello, I am feeling great" || loggedFromSpeak[1] !== "Hello, I am feeling just okay")

the exercise calls the method, but using a , will separate the log statement incorrectly in the loggedFromSpeak array


#7

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