O'Reilly logo

Get Programming with JavaScript Next: New features of ECMAScript 2015, 2016, and beyond by JD Isaacks

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Lesson 25. Maps

After reading lesson 25, you will

  • Know to create a Map
  • How to convert a plain object into a Map
  • How to add and access values on a Map
  • How to iterate the keys and values from a Map
  • How Maps are destructured
  • Understand when it makes sense to use a Map over an Object
  • Understand why it makes sense to use a WeakMap over a Map

Like Sets, Maps are a new type of object in JavaScript. Not to be confused with Array.prototype.map, which is a higher-order array method, Maps are another type of iterable that’s new to JavaScript in ES2015. A Map is a lot like a generic object in JavaScript with keys and values. But a Map can be iterated, whereas an object can’t. Plain objects are also limited to only being able to have string values as ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required