js merge and dedup tow array

علی ذوالفقار
1400/04/13 11:19:48 (58)
// merge tow tags (old and new)
var oldTags = [1,2,3,4] ;
var newTags = [2,3,5,7] ;
var tags = oldTags.concat(newTags);
// remove duplicated items
var newTags = (tags) ? tags.filter((item, pos) => tags.indexOf(item) === pos) : '' ;
Back