News for hackers. Stuff that matters.
Re:When I use classes, when I don’t, what I do instead and why by bramen on Sunday November 19, 2017 @03:19PM (#15735721)
There's already a proposal for field declarations, where you can do the following:

  class Foo {
    bar = () => {
      console.log(this);
    }
  }
This basically puts `this.bar = () => console.log(this)` in the constructor, and since it's an arrow function it captures the correct context.

See https://github.com/tc39/proposal-class-fields.

There are no comments on this comment yet.