I have a 2d array like this:
var arr = [[2,3],[5,8],[1,1],[0,9],[5,7]];
Each index stores an inner array containing the coordinates of some
Because this is a two dimensional Array, you will need a nested for loop.
var newArr = [1, 2],
counter;
for ( var i = 0; i < arr.length; i++ ) {
for ( var x = 0; x = arr[i].length; x++ ) {
if ( arr[i][x] === newArr[x] {
counter++
}
if (counter === 2) {
alert('new coord!')
}
}
//reset counter
counter = 0;
}