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 trialLukas Bager
Courses Plus Student 361 PointsWould you recommend arrow syntax?
Would you recommend using arrow syntax, when using iterator methods such as .forEach() .map() and .filter() ?
2 Answers
Steven Parker
231,269 PointsIt's important to be aware of the limitations of arrow functions: they do not have their own "this", "arguments", "super", or "new.target". And they cannot be used as constructors or generators.
But otherwise, I prefer them because they provide a more concise definition format, particularly for anonymous callback arguments.
For more information, see the MDN page on Arrow Functions.
Lukas Bager
Courses Plus Student 361 PointsThank you very much for the answers, it was very helpful :)
Alexander La Bianca
15,959 PointsAlexander La Bianca
15,959 PointsIt is a preference thing, but I prefer the arrow syntax at it keeps the code cleaner. Especially when you have several .map() stacked it can keep your code more concise. and you are dealing with objects