DEV Community

loading...

Discussion on: When You Should Use JavaScript Maps over Objects

Collapse
iwi4a_24 profile image
Ivelin

Excellent article! A little correction I would do is that when defining and adding values, new Map expects an array of arrays, so new Map(["key", "value"]); will throw an Uncaught TypeError, it should be new Map([["key", "value"]]);. Again, thank you for explaining it so well!