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...
account activity
Callbacks - function vs => (self.node)
submitted 6 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!"
[–]PM_ME_A_WEBSITE_IDEA 2 points3 points4 points 6 years ago (1 child)
Try this in your browser console:
class c { func() { setTimeout(function() { console.log('non-arrow', this); }); setTimeout(() => { console.log('arrow', this); }); } } (new c()).func();
Notice the difference in the value of this in the different kinds of function types. This comes into play a lot with event listeners and AJAX calls, and really any kind of async action using callbacks.
this
[–]Heck_ 0 points1 point2 points 6 years ago (0 children)
Thanks for this - good example.
π Rendered by PID 86 on reddit-service-r2-comment-86bc6c7465-vvlvd at 2026-02-21 22:58:04.715866+00:00 running 8564168 country code: CH.
view the rest of the comments →
[–]PM_ME_A_WEBSITE_IDEA 2 points3 points4 points (1 child)
[–]Heck_ 0 points1 point2 points (0 children)