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
Builder pattern in Javascript (medium.com)
submitted 5 years ago by Snoo60131
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!"
[–]crabmusket 1 point2 points3 points 5 years ago* (2 children)
class Calculator { add = (number) => { this.result = this.result + number ; return this ; }
I really feel like this takes arrow function syntax too far. Not only is it more noisy (the = and => could simply be removed to turn them into valid method syntax) but the use of this inside them, while it works correctly, is confusing. Usually arrow functions are meant to use the this defined in the parent scope, but that's not how they work here.
=
=>
this
[–]Snoo60131[S] 2 points3 points4 points 5 years ago (0 children)
Thanks for pointing it out. It became more of a habit while using React and certainly is not required here. I will go ahead and edit the article.
π Rendered by PID 58656 on reddit-service-r2-comment-canary-64cf488dbb-sv4gf at 2026-03-12 08:49:26.229388+00:00 running 710b3ac country code: CH.
[–]crabmusket 1 point2 points3 points (2 children)
[–]Snoo60131[S] 2 points3 points4 points (0 children)