O'Reilly logo

Understanding ECMAScript 6 by Nicholas C. Zakas

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

7SETS AND MAPS

image

For most of its history, JavaScript had only one type of collection, which was represented by the Array type. (Although some developers may argue that all nonarray objects are just collections of key-value pairs, their intended use was originally quite different from arrays.) Arrays in JavaScript are used just like arrays in other languages, but before ECMAScript 6, the lack of other collection options meant arrays were often used as queues and stacks as well. Because arrays use only numeric indexes, developers used nonarray objects whenever a nonnumeric index was necessary. That technique led to custom implementations of sets and ...

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