So I am trying to use arrays and for demonstration purposes I have condensed the code using points as examples. I want to create a point and push it to array and after doing stuff I want to remove the point from the array.
var PointArray = [];
function CreatePoint(X,Y){
this.x=X;
this.y=Y;
PointArray.push(this);
}
function RemovePoint(PointObject){
//????
}
var xPoint = CreatePoint(10,10);
//do stuff
RemovePoint(xPoint);
I was looking at the Array.prototype
manual and PointArray.Splice
seems like a the closest but feels messy since it wants indexs. Anyone have a clean way remove objects from array to shove into function RemovePoint
?