javaScript 2D array

please how can get the common value in 2D array ?
for instance, if i have a 2d array like this one
2d = [[2,5,7,9] , [7,1,0] , [12, 8, 3, 7]]
what can i do to get the common value “7” since it is in 2d[0], 2d[1] and in 2d[2] ?

arr = [[2, 6, 4, 9], [6, 4, 0], [4, 3, 1, 6]];
for (let i = 0; i < 1; i++) {
  for (let k = 0; k < arr[i].length; k++) {
    if (arr[1].includes(arr[i][k]) && arr[2].includes(arr[i][k])) {
      console.log(arr[i][k]);
    }
  }
};

This can be an example. But this example is not perfectly responsive. Subsequent arrays are written manually.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.