
I am a software developer who likes to deal with Frontend Web Development Technology.
SET
A Set is a special type of collection. A set can hold any value of any data type.
set(key,value)
key: The key of the element to add to the Map object.
value: The value of the element to add to the Map object.
ıf you use this object method but a long-time process of data may not be useful because you wait. but for some short processes is useful by the method. This set of methods:
new Set([iterable]),set.add(value),set.delete(value),set.has(value),set.clear(),set.size
const modelsSet = new Set(['Opel','Skoda','Opel','Audi','Renault',]);
console.log(modelsSet); // Output: Set(4){'Opel','Skoda','Audi','Renault'}
console.log(modelsSet.size); // Output: 4
console.log(modelsSet.has('Opel'); // Output: true
console.log(modelsSet.has('BMW'); // Output: false
A set is basically just a collection of unique values. Because it means that a set can never have any duplicates.
<script>
const shortSet = new Set(['GFG', 'JS']);
const array = [...shortSet];
console.log(array); // Output: GFG, JS
</script>


