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.