- Hands-On Data Structures and Algorithms with JavaScript
- Kashyap Mukkamala
- 175字
- 2021-06-30 19:12:16
Analyzing set and map types
Before actually using sets and maps, we will need to understand when and where we need to use them. Each data structure whether native or custom has its own strengths and weaknesses.
Not only is it important to utilize these strengths, it's much more important to avoid their weaknesses. To understand some of these, we will explore set and map types and why they are needed and where to employ them.
There are primarily four different set and map types:
- Map: A key-value pair in which the key can either be an Object or a primitive and can hold any arbitrary value.
- WeakMap: A key-value pair in which the key can only be an Object and can hold any arbitrary value. The Keys are weakly referenced; this means that they are not prevented from being garbage-collected if not in use.
- Set: Data type that allows a user to store unique values of any type.
- WeakSet: Similar to set, but maintains a weak reference.
推薦閱讀
- 深入淺出Electron:原理、工程與實踐
- PHP程序設計(慕課版)
- PyQt從入門到精通
- 新手學Visual C# 2008程序設計
- Mastering Ubuntu Server
- Scratch真好玩:教小孩學編程
- GitLab Repository Management
- 差分進化算法及其高維多目標優化應用
- Apache Spark 2.x for Java Developers
- Access 2010數據庫應用技術(第2版)
- Python機器學習:預測分析核心算法
- 一塊面包板玩轉Arduino編程
- Image Processing with ImageJ
- Unity 2018 Augmented Reality Projects
- TypeScript 2.x By Example