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 trialAnnika Noren
26,930 PointsTrouble with "Call and Apply" Challenge Question
I must be close, but something is off. I've put in
greeting.apply(andrew,args1);
but it's not working. What am I overlooking or missing?
4 Answers
Michael Jurgensen
8,341 PointsHi Annika,
You code is actually correct but the challenge wants you to write the code like this:
var greeting = genericGreet.apply(andrew,args1);
Annika Noren
26,930 PointsThank you!
Do you have an easy & short explanation as to why it needs to be like that? I'll rewatch the video, but if you have time to explain it that would be great!
I appreciate the help on the challenge.
Michael Jurgensen
8,341 PointsBoth answers are correct. You did nothing wrong. I tested your code in my browser and it works fine. For some reason the challenge only accepts that 1 answer.
mitchellsablosky
21,268 PointsI believe the problem with your answer is that you would be calling the undefined greeting variable and trying to apply the Andrew object and arguments to it, and the challenge is asking you to set the genericGreet method with the Andrew object and arguments applied to it as the greeting variable.
Maureen O'Neal
12,930 PointsYes, I had the same problem, it's confusing what exactly is desired.
Avery Kachline
10,458 PointsThank you both (John Grillo & Annika Noren)
I had the same solution as Annika with the
|| greeting.apply(andrew,args1); ||
Watch the video like 4 times and was not putting the pieces together. John code of
|| var greeting = genericGreet.apply(andrew,args1); ||
Worked like a charm!
John Grillo
30,241 PointsAvery Kachline, Glad to hear that || var greeting = genericGreet.apply(andrew,args1); ||
did the trick!
John Grillo
30,241 PointsJohn Grillo
30,241 PointsSo does it want the .call method as opposed to the .apply method?