EcmaScript Proposal – Private methods and fields proposals.

Sultan thysultan at gmail.com
Thu Apr 12 18:11:47 UTC 2018


[Strawman] Private methods and fields for JavaScript: https://github.
com/thysultan/proposal-private-methods-and-fields

```js

class A {
  private id = Symbol('unique')
  equal(instance, property) {
    return private(this)[property] == private(instance)[property]
  }
}

const x = new A()

x.equal(x, 'id')

```
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20180412/4b916ff8/attachment.html>


More information about the es-discuss mailing list