Suppose I have an array of objects called MyArray
and that a certain function returns a reference for a particular element within that array; something like this:
MyArray = [Object1, Object2, ..., Objectn];
function DoWork() {
var TheObject = GetTheObject(SomeParamter);
}
At this point, TheObject
points to a certain element in the Array. Suppose I want to remove this element from MyArray, is this possible without having to reloop through the array to get the index of the element? I'm looking for something like splice that would work with the reference to the element rather than the index of the element.
Thanks.
TheObject = null
will not clear the object from the array. You have it wrong. – Jon Jul 15 '13 at 15:19GetTheObject
that will remove iftrue
or keep iffalse
. – t.niese Jul 15 '13 at 15:21