New JavaScript Set methods | MDN Blog
July 3, 2024
New JavaScript Set methods are arriving! Since Firefox 127, these methods are available in most major browser engines, which means you won’t need a polyfill to make them work everywhere.
This article is a good read for people who are new to Set in JavaScript and are looking to find out how to use these new JavaScript methods. I’ll highlight some advantages of using these methods with basic examples to show why you might reach for these instead of building your own implementations.
I’m sure most of us learned about sets in primary school–unions, intersections, Venn diagrams, that sort of thing.
But working with sets in JavaScript (Sets are like arrays where any given only value van only appear once) has long been a lot of work. Now that work is much reduced.
Phil Nash covered these features at our recent Code conference (stream recording available for Conffab Pro members)