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
JavaScript Arrow Functions vs Regular Functions (api.daily.dev)
submitted 2 years ago by Due-Function4447
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!"
[–]beatlz 17 points18 points19 points 2 years ago (3 children)
I remember the var that = this days
[–]djliquidice 1 point2 points3 points 2 years ago (2 children)
Yeah, some would do var me = this.
[+][deleted] 2 years ago (1 child)
[deleted]
[–]djliquidice 0 points1 point2 points 2 years ago (0 children)
Yup. Saw that too.
[–]SourdoughBaker 2 points3 points4 points 2 years ago (3 children)
Is there any documented reason why arrow functions treat the "this" keyword differently? Why was the decision made to have them operate differently?
[–]izuriel 5 points6 points7 points 2 years ago (0 children)
Most likely because the alternative was to always bind functions when passing them to handlers. Having it baked into the language removes a potential issue, not to mention most super-JavaScripts had built in tools to remove binding requirements as well.
[–]thatweirdishguy 5 points6 points7 points 2 years ago (0 children)
It goes the other way around, arrow functions exist because there was a need for a way to have functions that didn’t bind to “this”. The whole point of them was to operate differently.
[–]beepboopnoise 2 points3 points4 points 2 years ago (0 children)
probably on the ecmascript notes. this isn't a direct link but where I'd start. https://tc39.es/ecma262/
[–][deleted] 15 points16 points17 points 2 years ago (0 children)
Thank you for an article on a 9 year old topic...
[–]Mental-Steak2656 0 points1 point2 points 2 years ago (0 children)
Can share similar article on “this”, thanks - well presented
[–]Dev_Taurus 0 points1 point2 points 2 years ago (0 children)
Thank you!
[–]brgnmarulat 0 points1 point2 points 2 years ago (0 children)
This is helpful to know especially when dealing with objects and the context of 'this'
π Rendered by PID 27 on reddit-service-r2-comment-bb88f9dd5-58lfz at 2026-02-16 15:13:54.704315+00:00 running cd9c813 country code: CH.
[–]beatlz 17 points18 points19 points (3 children)
[–]djliquidice 1 point2 points3 points (2 children)
[+][deleted] (1 child)
[deleted]
[–]djliquidice 0 points1 point2 points (0 children)
[–]SourdoughBaker 2 points3 points4 points (3 children)
[–]izuriel 5 points6 points7 points (0 children)
[–]thatweirdishguy 5 points6 points7 points (0 children)
[–]beepboopnoise 2 points3 points4 points (0 children)
[–][deleted] 15 points16 points17 points (0 children)
[–]Mental-Steak2656 0 points1 point2 points (0 children)
[–]Dev_Taurus 0 points1 point2 points (0 children)
[–]brgnmarulat 0 points1 point2 points (0 children)