javascript - How can I get unique data in different array -
i have 3 arrays this,
var data1 = ['a','b','c']; var data2 = ['b','c','d']; var data3 = ['c','d','e'];
then need push unique value in new data var newdata = [];
i need result in newdata
have 'a','b','c','d','e'
without duplicate
try this
var data1 = ['a','b','c']; var data2 = ['b','c','d']; var data3 = ['c','d','e']; var newarr=[] data1.concat(data2,data3).foreach(function(a,i){ if(newarr.indexof(a)===-1){ newarr.push(a) } }) console.log(newarr);
Comments
Post a Comment