Here is what we have:
var MyObject = function(){
var contents = [undefined,2,undefined,4,5];
this.getContents = function(){
return contents;
}
}
var o = new MyObject();
As you understand, o.getContents() has the value of [undefined,2,undefined,4,5]
What I want to do is remove the undefined values of that private array, without overwriting the entire array, without making the private contents public, and without changing the objects code in general.
myObject.getProperty().value = 10;) and wanted to share it. The reason I haven't accepted my answer, is because it is possible that someone has a better answer to this :)