The Map object holds key-value pairs and remembers the original insertion order of the keys. Any value (both objects and primitive values) may be used as either a key or a value. Map objects by default have their prototype, so it contains default keys that could potentially clash with your own keys.
Table of contents
What is the Map object?Syntax: Map vs ObjectReason 1: You Won't Overwrite Default Keys By AccidentReason 2: It Accepts Any Type As KeyReason 3: Maps Are IterableReason 4: Maps Can Be Merged With Arrays, And Converted To ArraysReason 5: You Can Easily Check The SizeThe downside? No Native Method For Serialization And Parsing2 Examples of how you can replace Object with MapConclusion1 Comment
Sort: