mirror of
https://github.com/ruanyf/es6tutorial.git
synced 2025-05-24 18:32:22 +00:00
docs(weakmap): 修正 weakMap 的例子 #536
This commit is contained in:
parent
e845e10525
commit
2ac6e76b38
@ -1034,8 +1034,9 @@ undefined
|
||||
undefined
|
||||
|
||||
// 设置 WeakMap 实例的键名,也指向 key 数组
|
||||
// 这时,key 数组的引用计数为 2,
|
||||
// 变量 key 引用一次,WeakMap 的键名引用第二次
|
||||
// 这时,key 数组实际被引用了两次,
|
||||
// 变量 key 引用一次,WeakMap 的键名引用了第二次
|
||||
// 但是,WeakMap 是弱引用,对于引擎来说,引用计数还是1
|
||||
> wm.set(key, 1);
|
||||
WeakMap {}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user