2

In JavaScript there are two kind of persons:
1) var self = this;
2) function(){}.bind(this);

Do you recognize yourself?

Comments
  • 3
    There's a third kind:
    Whatever was used in the stackoverflow answer 😂
  • 1
    Yeah, my new boss..
    var self = this.
    Every fucking time. I don't really get it. Whats the difference if I use this or self when this is self :D
  • 1
    Bind for sure, though it's not really required for this use case due to let and const being block scoped.

    I do mostly use it in react tho.
  • 1
    @SuperNOVA

    You're right is () => {}
    In ecmascript 6 Arrow functions does "bind" automatically :)
Add Comment