0 points

#15 Data Structures with JS examples: Sets - Frontend Weekly - Medium


dashboard

Fri May 29 2020 16:20:11 GMT+0000 (UTC)

Posted by @newborn #javascript

const mySet = new Set();
// adding items
mySet.add("a new item");
// searching for a item
mySet.has("a new item");
// getting the set  size
mySet.size()
// getting all items inside a set
mySet.values()
// removing item
mySet.delete("a new item");
// removing all items inside a set
mySet.clear()
content_copy Copy

https://medium.com/front-end-weekly/15-data-structures-with-js-examples-sets-5c0c7e52203