This is my first question here, so pardon me if I get something wrong.
I have an array of coordinates organized as objects, and I need to find and delete a certain object. I am stuck trying to get the position of the object with the specific x and y coordinates in the array.
Here is where I got to:
door_array = [{x:3, y:4},{x: 12,y: 12}, {x: 15,y:15}];
function remove_door(dx,dy, array)
{
var obj = {x:dx,y:dy};
var a = door_array.indexOf(obj); //this part doesn't work
door_array.slice(a,1)
}
When i try to call the function, it appears to read the array as [object,object,object], and returns -1.
The question is, how do I find the position of the specific object via it's coordinates so I can delete it?
{x: 4} === {x: 4} // false