Используя приведенную ниже функцию commonElements (), вы можете получить желаемый результат.
arr1 = [
["Test1", 20, "table", "Sample1", "NA"],
["Test2", 20, "table", "Sample2", "NA"],
["Test3", 20, "table", "Sample3", "NA"],
["Test4", 20, "table", "Sample4", "NA"],
["Test5", 20, "table", "Sample5", "NA"]
];
arr2 = [
["Test2", 20, "table", "Sample2", "NA"],
["Test4", 20, "table", "Sample4", "NA"],
["Test5", 20, "table", "Sample5", "NA"],
["Test6", 20, "table", "Sample6", "NA"],
["Test7", 20, "table", "Sample7", "NA"]
];
function notcommonElements(arr1, arr2) {
var obj = {}, matched = [],
unmatched = [];
for (var i = 0, l = arr1.length; i < l; i++) {
obj[arr1[i]] = (obj[arr1[i]] || 0) + 1;
}
for (i = 0; i < arr2.length; i++) {
var val = arr2[i];
if (val in obj) {
matched.push(val);
} else {
unmatched.push(val);
}
}
console.log(unmatched);
}
notcommonElements(arr1, arr2);