Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js push array unique

var items = ['hi', 'hello', 'uzi'];
var item = 'uzi';//change item here to unique item only then it will push
if(items.indexOf(item) === -1) {
     items.push(item);
    console.log(items);
}
 
PREVIOUS NEXT
Tagged: #js #push #array #unique
ADD COMMENT
Topic
Name
9+4 =