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 trialCrystal Vesely
14,500 PointsTrying to understand how the parameter “data” in the line callback(data), puts the data where (json)
I am confused as to how data within the callback(data) is passing info to the “json” parameter within the arrow function that is being passed to it as a callback function.
When we pass generateHTML, the syntax matches, so it makes sense to me. But not when the arrow function is sent. Could someone explain? Thanks so much.
1 Answer
Crystal Vesely
14,500 PointsOk, I think I figured it out. In order to call an anonymous function, you have to call it with (). So when the arrow function is passed as an argument, when it executes callback(), it essentially is making a call to that function. Please let me know if I’m wrong. But I tried to research it until my head started hurting lol