Sets - Javascript
var = new Set([iterable]) => Giving parameter is optional
var.add(value) => Adds the value to the set, If repeated then doesn't add
var.delete(value) => Deletes an element with the specified value from the Set object
var.clear() => Removes all the element from the set
var.entries() => Returns an iterator object which contains an array having the entries of the set, in the insertion order
var.has(value) => Returns true if the specified value is present in the Set object
var.values() => Returns all the values from the Set in the same insertion order
var.keys() => Returns all the values from the Set in the insertion order, keys() is similar to the values() in case of Sets
var.size => Returns the size of set with unique entries
- for(let item of var) {}` => Can directly access items of set by for loop
var.forEach((item) => {statement}) => Can directly access item of set by for loop
Array.from(var) => Create an array from set