Private data for objects in JavaScript
Labels: dev, ecmascript.next, javascript, jsguide
- Instance of a constructor – private data in environment of constructor
- Singleton object – private data in environment of object-wrapping IIFE
- Any object – private data in properties with marked names
- Any object – private data in properties with reified names
- Single method – private data in environment of method-wrapping IIFE
Required knowledge: While everything is explained relatively slowly, you should probably be familiar with environments and IIFEs [1] and with inheritance and constructors [2].
Комментариев нет:
Отправить комментарий