var arrays = [[1, 2]],
array = [1, 2],
index = arrays.indexOf(array);
console.log(index);
In the code above, the value of index
is -1
, indicating that the array [1,2]
could not be found inside of [[1,2]]
. The method works fine for one-dimensional arrays, but why doesn't it seem to work for multi-dimensional arrays? or am I doing something wrong?