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

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -