From f7255377432937fed70ade886169e50a17d1f2eb Mon Sep 17 00:00:00 2001 From: Lukasz Ciesluk Date: Fri, 25 Jan 2019 09:00:04 +0000 Subject: [PATCH] Update article about WeakMap's delete function It seems that it's small typo in delete function of WeakMap as according to specification delete function takes only one parameter - key --- 1-js/05-data-types/07-map-set-weakmap-weakset/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/05-data-types/07-map-set-weakmap-weakset/article.md b/1-js/05-data-types/07-map-set-weakmap-weakset/article.md index ecbc08f9..927d6069 100644 --- a/1-js/05-data-types/07-map-set-weakmap-weakset/article.md +++ b/1-js/05-data-types/07-map-set-weakmap-weakset/article.md @@ -328,7 +328,7 @@ Compare it with the regular `Map` example above. Now if `john` only exists as th - `weakMap.get(key)` - `weakMap.set(key, value)` -- `weakMap.delete(key, value)` +- `weakMap.delete(key)` - `weakMap.has(key)` Why such a limitation? That's for technical reasons. If an object has lost all other references (like `john` in the code above), then it is to be garbage-collected automatically. But technically it's not exactly specified *when the cleanup happens*.