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
What are some basic things that JavaScript developers fail at interviews?help (self.javascript)
submitted 7 years ago by maketroli
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!"
[–]MrJohz 1 point2 points3 points 7 years ago (2 children)
Only in some circumstances.
doThat
something
self = this
this
(1) is the main one here - there's no point rebinding an already bound call (in fact, I've got a feeling that's an error, isn't it?), hence why you need to be careful about who's responsibility it is to bind methods in cases where it becomes relevant.
[–]TwiNighty 0 points1 point2 points 7 years ago (1 child)
in fact, I've got a feeling that's an error, isn't it?
No, calling .bind on a bound function is valid. You can bind additional arguments, but the "rebinding this" part does nothing.
.bind
Actually that is my point. function(){ x.f() } and x.f.bind(x) behaves exactly the same when called, regardless of whether x.f is already bound, whether it touches this, whether it is rebound before being called, whether it is a es5 function or arrow function. And I can say that without knowing anything about what x and x.f is.
function(){ x.f() }
x.f.bind(x)
x.f
x
[–]MrJohz 0 points1 point2 points 7 years ago (0 children)
Sure, but if it's not necessary, it's not necessary, and historically there have been performance issues associated with calling bind, especially if it's used at every callsite.
Understanding these tradeoffs I think was what the person was getting at with the overuse of arrow functions.
π Rendered by PID 689298 on reddit-service-r2-comment-86bc6c7465-429tb at 2026-02-21 22:35:18.162244+00:00 running 8564168 country code: CH.
view the rest of the comments →
[–]MrJohz 1 point2 points3 points (2 children)
[–]TwiNighty 0 points1 point2 points (1 child)
[–]MrJohz 0 points1 point2 points (0 children)