Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript JavaScript Foundations Objects Call and Apply

228 Points

Issue with answer

I solved the problem correctly but system is not showing me that. My answer is greeting.apply(andrew, args1) at line 30. Please advise what I am doing wrong. Thanks, Raman

3 Answers

Hi R D,

Can't tell you what you're doing wrong without seeing the code.


228 Points

Hi Jeff,

Below is the code:

var genericGreet = function(name, mood) { name = name || "you"; mood = mood || "good"; return "Hello " + name + ", my name is " + this.name + " and I am in a " + mood + " mood!"; };

  var andrew = {
    name: "Andrew"

  var args1 = ["Michael", "awesome"];

  var greeting = genericGreet;
  greeting.apply(andrew, args1);

If I do "greeting.apply(andrew, args1)" in the console then I got the below output but not in the browser. "Hello Michael, my name is Andrew and I am in a awesome mood!"

I believe this is what they're looking for.

var greeting = genericGreet.apply(andrew,args1);