Compare 2 arrays and show unmatched elements from array 1

0
1247

You could use filter and Set, providing the Set as context to the filter method, so it can be accessed as this:

var check= ["044", "451"],
data = ["343", "333", "044", "123", "444", "555"];

var res = check.filter( function(n) { return !this.has(n) }, new Set(data) );

console.log(res);

Reference Link – https://stackoverflow.com/questions/40537972/compare-2-arrays-and-show-unmatched-elements-from-array-1

LEAVE A REPLY

Please enter your comment!
Please enter your name here