3. Literally Speaking


#1

My code does pass through the lesson but the result I believe it expects to show in the console does not show. All that is shown is the error message down below, and I wish to make sure I did everything correctly so I do not misunderstand anything.



RangeError: Maximum call stack size exceeded


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

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


#2

Update
After checking some other people's things I have gotten rid of the error message and my code is now this.

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

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

My code still does not show up in the console log and I do not understand why not.


#3

Ah, so you caught that recursion. Good work. I don't see any reason why your new code won't display anything. The code is fine. Could it just need a refresh, maybe?


#4

2 posts were split to a new topic: Its not working


#5

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