Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Daniel Hunter
7,349 PointsCall and Apply Challenge
Have trouble with this one. I know it's got to be simple, just can't see it.
Set the 'greeting' variable, on line 29, by using the 'genericGreet' function in the context of 'andrew' with the array of arguments, 'args1'.
var andrew = {
name: "Andrew"
}
var args1 = ["Michael", "awesome", ":)"];
var greeting = genericGreet;
1 Answer
Ken Alger
Treehouse TeacherDaniel;
Let's break this task down, it states:
Set the 'greeting' variable, on line 29, by using the 'genericGreet' function in the context of 'andrew' with the array of arguments, 'args1'.
The challenge gave us as a starting point:
var greeting = genericGreet;
Up on line 16 we can see the genericGreet function that has two arguments, name and mood.
The challenge is asking us to use the genericGreet function with 'andrew' and 'args1', so our code snipet would look like:
// Course: JavaScript Foundations
// Module: Objects
// Challenge: Call and Apply
// Task: 1 of 1
var greeting = genericGreet.apply(andrew, args1);
Does that help at all?
Ken
Daniel Hunter
7,349 PointsDaniel Hunter
7,349 PointsThanks Ken, this was really helpful. I think I just wasn't clear on what the question was asking. For some reason, using .apply didn't register to me.