Re:Implementing Private Fields for JavaScript
by TazeTSchnitzel on Sunday June 13, 2021 @03:29AM
(#27490557)
I'm surprised they're adding private fields when symbols already exist? Is it just for improved convenience?
[ Parent
| on HN ]
Object properties defined as Symbols (even through classes) are still accessible by e.g.
Object.getOwnPropertyDescriptors(myObject)
Before the private fields, it was possible to create private properties through a WeakMap object which is somewhat clumsy and not very performant.