The dictionary data structure

As we have already learned, a set is a collection of distinct elements (non-repeated elements). A dictionary is used to store [key, value] pairs, where the key could be used to find a particular element. A dictionary is very similar to a set; a set stores a [key, key] collection of elements, and a dictionary stores a [key, value] collection of elements. A dictionary is also known as a map, symbol table, and an associative array.

In computer science, dictionaries are often used to store the reference address of objects. For example, if we open the Chrome | Developer tools in the Memory tab and run a snapshot, we will be able to see some objects and their respective address references in the memory (represented ...

Get Learning JavaScript Data Structures and Algorithms - Third 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.