Jordan Harband schrieb: > JD Isaacks <[email protected]> wrote: > >> class Foo { >> bar = () => { >> // bound >> } >> buz() { >> // unbound >> } >> }
In your first example, the arrow function's "this" would be the "this" of the context the "class" is defined in - it wouldn't be bound at all.
No, the methods defined with "=" are automatically moved into the constructor, so that they are created once for each new instance. `this` in the arrow function would in fact be bound to the instance.
It's indeed super-confusing to "declare" such methods right inside the `class` though, that's why I'm really opposing that proposal (https://github.com/jeffmo/es-class-static-properties-and-fields).
Greetings, Bergi _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

