January 2018
Intermediate to advanced
332 pages
7h 36m
English
Before we try and understand how to use sets and maps in real-world applications, it is more meaningful to understand the origin of sets and maps and why we need them in JavaScript in the first place.
Traditional arrays, until ES5, did not support a few major features, that developers usually want to leverage:
This led to developers implementing their own versions of sets and maps, which were available in other programming languages. A common implementation of a set and map using JavaScript's Object is as follows:
// create an empty objectvar setOrMap = Object.create(null);// assign a key and valuesetOrMap.someKey ...
Read now
Unlock full access