var array1 = ["2017-07-23_30-12-98","2016-06-23_13-12-23","2017-05-20_30-12-43","2015-02-23_30-12-98"];
var array2 = ["2017-07-23_30-12-98","2014-06-23_13-12-94","2015-05-20_30-12-98","2015-02-23_30-12-98"];
console.log(
array1.reduce((obj, s) => {
if(array2.indexOf(s) !== -1) {
obj.matched.push(s);
} else {
obj.unmatched.push(s);
}
return obj;
}, {matched: [], unmatched: []})
)
solved i have to get result like bellow – from two arrays in javascript [closed]