mastodon.ar.al is one of the many independent Mastodon servers you can use to participate in the fediverse.
This is my personal fediverse server.

Administered by:

Server stats:

1
active users

Aral Balkan

Oh my goodness, how did I miss that in ES7 you can use a closure as a method. Goodbye `bind()`, you will not be missed :)

e.g.,

```js
class A {
b = () => console.log(this)
}

const a = new A()
a.b() // A { b: [Function: b] }

const c = a.b
c() // A { b: [Function:b] }
```

Nice! :)

**Edit**: Be careful with this. See this note by @marsup: mastodon.social/@marsup/113799

MastodonMarsup (@marsup@mastodon.social)@aral@mastodon.ar.al Respectfully, this looks like an anti-pattern. `b` won't be part of the prototype, potentially preventing some meta programming, and you're going to get a new `b` for each instance of that class, consuming that much more memory for each instance you hold.

@aral Respectfully, this looks like an anti-pattern. `b` won't be part of the prototype, potentially preventing some meta programming, and you're going to get a new `b` for each instance of that class, consuming that much more memory for each instance you hold.

@marsup Ah, poopee, just checked, you’re right. Thanks :)