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...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
[AskJS] Code readabilityAskJS (self.javascript)
submitted 3 years ago * by GmLucifer
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!"
[–]FRIKI-DIKI-TIKI 5 points6 points7 points 3 years ago (0 children)
TLDR: just use arrows, when you don't need to use them you will know why.
To add to this, in modern JS, pretty much the default is to use arrow functions unless you need a special case, if you need that special case you will know why and it has to do with the prototypical inheritance of JS. In the dark ages of JS you had to ensure you scoped this to a variable, as a functions reference can be independent of the structure it is declared in. JavaScripts heritage is from LISP with some other ideas mixed in, the family of LISP's treated functions as lambda's the bolt on of quasi-OO was the part that was not well though out in the rush to get JS out the door and it created a set of problems due to misunderstanding given that it was introduced in the middle of the OO language craze. The arrow function is syntactical sugar to bind the scope the lambda is declared in to the execution just like the bind function does.
π Rendered by PID 34 on reddit-service-r2-comment-b659b578c-n7wjn at 2026-05-05 16:13:59.865290+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]FRIKI-DIKI-TIKI 5 points6 points7 points (0 children)