|
|
|
|
|
by pcwalton
3802 days ago
|
|
It was really hard to make truly private properties that couldn't be leaked in some way without WeakMap. If you don't need foolproof leakage, Symbols are a more convenient way to get most of the benefits of private properties. This is intentional: as I recall, the committee realized that WeakMap wasn't the most ergonomic solution and created Symbols as a more convenient, though less ironclad, alternative. |
|
[1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...