I can remove objects from an array by doing this:
for (i in oCache){
if (i == "test"){
delete oCache[i];
};
};
However, the array's length property is unaffected.
If I use splice like so:
for (i in oCache){
if (i == "test"){
oCache.splice(i , 1);
};
};
It breaks because oCache's length is altered within the loop by splice.
How do I iterate though an array, remove items AND change the length
property?
Thanks,
Derek Basch
for (i in oCache){
if (i == "test"){
delete oCache[i];
};
};
However, the array's length property is unaffected.
If I use splice like so:
for (i in oCache){
if (i == "test"){
oCache.splice(i , 1);
};
};
It breaks because oCache's length is altered within the loop by splice.
How do I iterate though an array, remove items AND change the length
property?
Thanks,
Derek Basch
Comment