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 trialRoald Jurrian Kamman
Front End Web Development Techdegree Graduate 15,544 PointsKeep 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!
1 Answer
Steven Parker
231,109 PointsArrow 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.
ja5on
10,338 Pointsja5on
10,338 PointsI would like to say I find arrow functions good to work with on mathematical problems (using numbers) however I prefer using function declarations when working mostly with (word based) programming so that I can read it easier albeit I don't have that much experience yet in projects. Is this ok Steven Parker, In your experience?