- Hands-On Data Structures and Algorithms with JavaScript
- Kashyap Mukkamala
- 138字
- 2021-06-30 19:12:17
The API difference
The API difference as documented in WeakMap case of maps is pretty close to what you can find for Sets as well:
- Set.prototype.size: Returns the size of the set
- Set.prototype.add: Adds a value for a given element and returns the entire new set
- Set.prototype.delete: Deletes an element and returns true if delete was successful, otherwise false
- Set.prototype.has: Checks the set for the presence of an element and returns a Boolean
- Set.prototype.clear: Clears the set and returns nothing
- Set.prototype.forEach: Loops over the set and gives access to each element
- Set.prototype.values: Returns an iterator, which can be used to get access to the next value
- Set.prototype.keys: Similar to values—returns access to values in the set
WeakSet, on the other hand, does not contain the forEach(), keys(), and values() methods for reasons discussed previously.
推薦閱讀
- Mastering Adobe Captivate 2017(Fourth Edition)
- ASP.NET MVC4框架揭秘
- Python for Secret Agents:Volume II
- Learning Data Mining with Python
- Xcode 7 Essentials(Second Edition)
- INSTANT MinGW Starter
- bbPress Complete
- Anaconda數據科學實戰
- Python Digital Forensics Cookbook
- Unity Android Game Development by Example Beginner's Guide
- Python數據科學實踐指南
- 你必須知道的.NET(第2版)
- WCF全面解析
- 大話代碼架構:項目實戰版
- Microsoft Windows Identity Foundation Cookbook