Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js push into array if item exist

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