Gord
02-09-2006, 08:16 AM
I have an array which contains objects & am trying to delete one of the objects & the array reference to it.
eg:
var myArray = new Array (object1,object2,object3);
//myArray.length=3 at this point
delete myArray[2];
// myArray.length still = 3; object3 has been deleted.
I want myArray.length to = 2 after the deletion
How can I delete myArray[2] (Just element 2 , not the complete array) so that it is 'Undeclared" rather than "Undefined" and future references to myArray.length will return a value of 2 ?
Thanks Gord
eg:
var myArray = new Array (object1,object2,object3);
//myArray.length=3 at this point
delete myArray[2];
// myArray.length still = 3; object3 has been deleted.
I want myArray.length to = 2 after the deletion
How can I delete myArray[2] (Just element 2 , not the complete array) so that it is 'Undeclared" rather than "Undefined" and future references to myArray.length will return a value of 2 ?
Thanks Gord