Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js add item to array

var s = new Set();

// Adding alues
s.add('hello');
s.add('world');
s.add('hello'); // already exists

// Removing values
s.delete('world');

var array = Array.from(s);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #js #add #item #array
ADD COMMENT
Topic
Name
8+4 =