From 7ffb6ce9bb98bea2631e19a6d95f74674a72bc82 Mon Sep 17 00:00:00 2001 From: Letu Ren <46747123+FantasqueX@users.noreply.github.com> Date: Wed, 2 Dec 2020 16:55:33 +0800 Subject: [PATCH] fix typo "colector" => "collector" Fix typo in line 287 --- 1-js/05-data-types/08-weakmap-weakset/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/05-data-types/08-weakmap-weakset/article.md b/1-js/05-data-types/08-weakmap-weakset/article.md index 6c3a2828..2dedf8f1 100644 --- a/1-js/05-data-types/08-weakmap-weakset/article.md +++ b/1-js/05-data-types/08-weakmap-weakset/article.md @@ -284,7 +284,7 @@ The most notable limitation of `WeakMap` and `WeakSet` is the absence of iterati `WeakSet` is `Set`-like collection that stores only objects and removes them once they become inaccessible by other means. -It's main advantages are that they have weak reference to objects, so they can easily be removed by garbage colector. +It's main advantages are that they have weak reference to objects, so they can easily be removed by garbage collector. That comes at the cost of not having support for `clear`, `size`, `keys`, `values` ... `WeakMap` and `WeakSet` are used as "secondary" data structures in addition to the "primary" object storage. Once the object is removed from the primary storage, if it is only found as the key of `WeakMap` or in a `WeakSet`, it will be cleaned up automatically.