News for hackers. Stuff that matters.
Re:Airbnb JavaScript Style Guide by z3t4 on Friday July 03, 2015 @10:24AM (#9825743)
About referencing "this": It can be very useful when writing object constructors, if you always reference an object with the constructor's name.

  function Foo() {
    var foo = this;
    foo.bar = 1;
    foo.az = 2;
  }

  var foo = new Foo();
  foo.bar = foo.bar + 5;
Then it will be super easy to rename say foo.bar to something else. It's also self "documented".

There are no comments on this comment yet.