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
This commit is contained in:
parent
028b80cf9d
commit
f725537743
1 changed files with 1 additions and 1 deletions
|
@ -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*.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue