i want to match an array with another array if the content in array is same with another array and how many is match, for example:
array2 = [1,2,3];
array1 = [1,3];
console.log(findMatch(array1,array2));
//result["total_match"] = 2
//result["not_match"] = [2]
array2 = [4,5,6];
array1 = [6,4,5];
console.log(findMatch(array1,array2));
//result["total_match"] = 3
//result["not_match"] = []
array2 = [1,4,7];
array1 = [4,2,3,8,5];
console.log(findMatch(array1,array2));
//result["total_match"] = 1
//result["not_match"] = [1,7]
function findMatch(array1,array2){ // fill
var result = [];
result["total_match"] = 0;
result["not_match"] = [];
//????
return result;
}
basically the array2 is an array with 3-index that i want to match with another dynamic array1, i want to get the result of the total match, and the value that not match in an array
map,reduce, orfiltermethods? There are lots of great Array methods out there to help you: developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/…not_matchare unclear, OR you just provided wrong examples.