Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
Roald Jurrian KammanFront End Web Development Techdegree Graduate 15,538 Points
Keep It Stupidly Simple KISS on arrow functions.
Are arrow functions really necessary beyond making the syntax shorter?
To be clear I don't think shorter syntax means more readable syntax. For the same reason that you wouldn't like editing a .min file.
It's something I have noticed with coding that there is a lot of unnecessary over-complication.
Personally I always revert arrow syntax back into regular function() expressions in my projects. I find it easier to keep track of what's going on that way.
Maybe it's just personal preference.
To be clear I'm not complaining about it and I think it's great that we learn about it so that when we encounter it we are able to work with it and read/edit it.
The whole thing just seems redundant to me. I would trade simplicity over complexity any day as long as the results on the end product are the same.
Does using arrow functions make the end product considerably faster in terms of loading speed or any other results that I'm unaware of? I would love to hear if there is another good reason to use arrow syntax. Thanks!
Steven Parker215,372 Points
Arrow functions mainly make the code more concise, particularly if you use the compact form.
But it's important to recognize that they work differently from conventional functions, though the differences will only be pertinent in certain situations.
For more details on the differences, see the MDN page on Arrow function expressions.