Get Unique Array value from two array in javascript
var data = [1 ,9]; // console.log(‘data’, data); var newdata = [1 ,2 ,3,9]; newdata.forEach((item, index)=>{ if(data.indexOf(item) == –1 ) { console.log(‘not found ‘, item); } })
var data = [1 ,9]; // console.log(‘data’, data); var newdata = [1 ,2 ,3,9]; newdata.forEach((item, index)=>{ if(data.indexOf(item) == –1 ) { console.log(‘not found ‘, item); } })
var olddata= [ { name:“string 1”, value:“this”, other: “that” }, { name:“string 2”, value:“this”, other: “that” } ]; var newdata = [ { name:“string 1”, value:“this”, other: “that” }, { name:“string 5”, value:“this”, other: “that” }, { name:“string 4”, value:“this”, other: “that” } ]; newdata.forEach((items, index)=>{ if( olddata.findIndex(item => item.name === items.name) == –1){ …
Get Unique Object Data From two array of objects in Javascript Read More »