Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
rezadhah838yWait a minute, self is not a reserved word in js rigth? So you will assign context/window object to self. Or is it? ..
-
@featurenotbug @Brachacz It's "bad" because you can use bind/call/apply to set context for functions since ES3. And since ES6 you can just use arrow functions.
-
Nexion12738yThere is a decent functional reason for doing this. If you are binding event handlers in inner methods, but still need a reference to the parent object, self will then reference the parent. You can get around this other ways. However just renaming "this" for the sake of it is beyond annoying.
Related Rants
var self = this;
undefined
wk47