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
Logging objects to the console
Maybe I missed something in an old vid but this syntax per 3:10 logs the objects to the console. I have no idea what this is:
data.map(p => console.log(p));
Is it some kind of loop? Was this .map function mentioned somewhere earlier?
Steven Parker228,991 Points
It generates a new array by applying the function argument to each element of the given array. How it is being used here seems a bit bizarre — I would have chosen "forEach" instead.
Anytime I run into something I don't recognize (or remember in detail), I just look it up on MDN. For example, here's the MDN page for map().