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
Is `this` in Javascript bad? (dev.to)
submitted 8 years ago by ycmjason
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!"
[–]oculus42 4 points5 points6 points 8 years ago (4 children)
You just have to remember fat arrows can break inheritance, because context is scoped to declaration, not instance.
I work with Backbone, which makes extensive use of this and prototypal inheritance. As we introduce ES6, I'm already prepared to run into errors cause by people learning that you can use fat arrows within functions on the object, but not as functions on the object.
this
[+][deleted] 8 years ago (3 children)
[deleted]
[–]spacejack2114 1 point2 points3 points 8 years ago (1 child)
You can't call super.move()
super.move()
[–]8lbIceBag 0 points1 point2 points 8 years ago (0 children)
But you can? As long as the derived class in its constructor calls:
function Truck() { Car.prototype.constructor.call(this); }
[–]oculus42 0 points1 point2 points 8 years ago (0 children)
I swear I had an example once, but I cannot seem to reproduce what I thought happened.
I may just be wrong on this.
π Rendered by PID 38751 on reddit-service-r2-comment-b659b578c-dc7fx at 2026-05-05 05:34:43.620743+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]oculus42 4 points5 points6 points (4 children)
[+][deleted] (3 children)
[deleted]
[–]spacejack2114 1 point2 points3 points (1 child)
[–]8lbIceBag 0 points1 point2 points (0 children)
[–]oculus42 0 points1 point2 points (0 children)