Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript Adding New Elements

const set = new Set([1, 2]);
console.log(set.values());

// adding new elements
set.add(3);
console.log(set.values());

// adding duplicate elements
// does not add to Set
set.add(1);
console.log(set.values());
 
PREVIOUS NEXT
Tagged: #javascript #Adding #New #Elements
ADD COMMENT
Topic
Name
1+4 =