Guided Notes
Sets, Maps, Dates & JSON
Unique values with Set, keyβvalue collections with Map, working with dates, and converting data to and from JSON.
Sets
Slide 1 / 5A Set stores unique values β duplicates are ignored:
const tags = new Set(['js', 'css', 'js']); tags.size β 2 tags.add('html'); tags.has('css') β true tags.delete('css');
The quickest way to remove duplicates from an array:
[...new Set([1, 2, 2, 3, 3])] β [1, 2, 3]
Loop with for...of. Sets also make membership checks fast on large collections.
