I am using javascript to compare a single array and a multidimensional array. Here i want to compare those 2 array and the matched value should be shown.
arr[1,2,3]
value to be searched in multidimensional array " md2 ".
This is my Code :: i have taken an single array and other as multidimensional array
var arr = [1,2,3];
var md2 = [[23,8,2],[1,5,8],[1,2,3],[8,5,2]];
for(var j=0; j<md2.length ; j++){
if(arr == md2[j]){
console.log(arr + " ... " + md2[j]);
}
}
Required O/P :- [1,2,3]
should match and should be displayed in the console