Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to push only unique values in array in javascript

if(this.items.indexOf(item) === -1) {
    this.items.push(item);
    console.log(this.items);
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #push #unique #values #array #javascript
ADD COMMENT
Topic
Name
9+3 =