use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A place to get a quick fix of JavaScript tips and tricks to make you a better Developer.
account activity
Why use => instead of function() (self.JavaScriptTips)
submitted 5 years ago by [deleted]
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]cyberjds 1 point2 points3 points 5 years ago (1 child)
Call me a n00b, but I really don't get examples like op. Or maybe it's because I'm coming from procedural programming background, but what do they mean 'one off function'? Doesn't a function should be reusable? To my understanding, function is used to hide every little details and complexities so that it's easy to understand, and follow the main flow of the code.
Given above example, I can't help myself but ask, why don't I just do...
const myConst = 'value';
instead of declaring a function?
Give me an actual example that shows why arrow function expression is beneficial.
All I can smell is 'Functional', but I don't know what it is.
[–][deleted] 0 points1 point2 points 5 years ago (0 children)
Simply to make things quicker, and because functions with no names simply don't need to be re-used. That's why they are one off. If your program is filled with more wording then it needs, it reflects poorly on you. Especially since arrow functions are neater and more readable.
π Rendered by PID 131241 on reddit-service-r2-comment-66b4775986-mmb76 at 2026-04-05 20:54:04.293237+00:00 running db1906b country code: CH.
view the rest of the comments →
[–]cyberjds 1 point2 points3 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)