From f17ad4a8a2c1a6fa5d6058e704e3493c6efa7888 Mon Sep 17 00:00:00 2001 From: clf Date: Fri, 10 May 2024 17:35:00 +0900 Subject: [PATCH] =?UTF-8?q?WeakMap=E7=9A=84=E5=BC=B1=E5=BC=95=E7=94=A8?= =?UTF-8?q?=E9=94=AE=E7=9A=84=E6=8F=8F=E8=BF=B0=E5=AE=B9=E6=98=93=E6=9C=89?= =?UTF-8?q?=E6=AD=A7=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap an object's presence as a `key` in a WeakMap does not prevent the object from being garbage collected. Once an object used as a key has been collected, its corresponding values in any WeakMap become candidates for garbage collection as well --- docs/es6/dataStructure.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/es6/dataStructure.md b/docs/es6/dataStructure.md index 14bcc359..09b9ba62 100644 --- a/docs/es6/dataStructure.md +++ b/docs/es6/dataStructure.md @@ -217,7 +217,7 @@ map.forEach((value, key) => { console.log(key, value)}) 与`Map`的区别 - Map 的键可以是任意类型,WeakMap 的键只能是对象类型 -- WeakMap 键名所指向的对象,不计入垃圾回收机制 +- WeakMap 的键对象,不计入垃圾回收机制 `WeakMap` 的属性跟操作方法与 `Map` 一致,同 `WeakSet` 一样,因为是弱引用,所以 `WeakSet` 也没有遍历方法