I have a 2D array of certain coordinates :
var array = [ [5, 34], [31, 82], [10, 31], [25, 24] ]
Now I want to remove some pairs of coordinates from the array. Let's say I don't need [31, 82]
. How do I remove this element from the array? I tried this :
var coords = [31, 82];
let index = arr.indexOf(coords);
if (index !== -1) arr.splice(index, 1);
But it doesn't work.