问题 1
Explain the 'WeakMap' and 'WeakSet' data structures in ES6.
WeakMap and WeakSet are similar to Map and Set, respectively, but they allow for garbage collection of keys and values that are not used elsewhere.
Example:
let weakMap = new WeakMap(); let obj = {}; weakMap.set(obj, 'some value');
保存以便复习
保存以便复习
收藏此条目、标记为困难题,或将其加入复习集合。
这有帮助吗?
添加评论
查看评论