loading
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Empty Set
 let vowels = new Set();

vowels.add('a').add('e').add('i').add('o').add('u');

// Verify Set value
console.log(vowels.has('a'));
console.log(vowels.has('n'));

// Loop over Set
vowels.forEach(function(value) { 
   console.log(value);
});

// Duplicate Set values are ignored 
console.log(vowels);
vowels.add('e');
console.log(vowels);

// Populate Set on creation 
let primeNumbers = new Set([2,3,5,7,11]);

// Delete Set value 
console.log(primeNumbers);
primeNumbers.delete(11);
console.log(primeNumbers);



 

 
Native Browser JavaScript