| As a heads up since you mentioned "class method syntax", methods are one of the most important places to have lexical `this` binding in many scenarios. Take the following example, which is a normal class method: > alertSum() { alert(this.a + this.b); } And here we have an arrow function used to create an instance method (just an arrow function assigned to a property on the instance): > alertSum = () => { alert(this.a + this.b); } Then let's say we want to pass the method directly as callback: > this.button.addEventListener('click', this.alertSum) The first example (class method syntax) won't have the necessary `this` context unless it has its context bound to the instance through `Function.prototype.bind`. There are other patterns to avoid this (e.g. wrapping all callbacks in arrow functions when passing them), but it's useful to consider that classes methods can easily create confusion because that's _exactly where_ someone more used to a different language may assume the `this` context is bound lexically. |
Edit: I was confused about how this could work, so I dug through [1] for a bit. It appears that for each object of that class created, an arrow function will be created on that object and its this will indeed be bound to the same scope that the constructor function is bound to. This is really cleaver and I applaud whoever thought it up!
It is interesting to note that this creates a new arrow function on each object as opposed to the normal definitions which create a single function which is stored in the prototype of the class. (its easier to check this in a browser's dev console then it is to decode the spec)
This would suggest that one should use different approaches for different types of objects: It makes sense to use arrow functions for "resource" or "actor" objects, of which there are few but they may have callback functions. It makes sense to use normal method definitions for "plain old data", of which there may be many, (which would make the arrow functions too expensive) but they should not have callback functions.
[1] https://tc39.es/proposal-class-fields/unified.html