April 2018
Beginner to intermediate
426 pages
10h 19m
English
ECMAScript 2015 introduced a Set class as part of the JavaScript API. We developed our Set class based on the ES2015 Set class.
Now, let's take a look at how we can use the native Set class, as well.
Let's use the same examples we used to test our Set class, as follows:
const set = new Set(); set.add(1); console.log(set.values()); // outputs @Iterator console.log(set.has(1)); // outputs true console.log(set.size); // outputs 1
The difference between our Set class and the ES2015 Set class is that the values method returns ...