Chapter 9. Dealing with collections

This chapter covers

  • Creating and modifying arrays
  • Using and reusing array functions
  • Creating dictionaries with maps
  • Creating collections of unique objects with sets

Now that we’ve spent some time wrangling the particularities of object-orientation in JavaScript, we’ll move on to a closely related topic: collections of items. We’ll start with arrays, the most basic type of collection in JavaScript, and look at some array peculiarities you may not expect if your programming background is in another programming language. We’ll continue by exploring some of the built-in array methods that will help you write more elegant array-handling code.

Next, we’ll discuss two new ES6 collections: maps and sets. Using maps, ...

Get Secrets of the JavaScript Ninja, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.