I
Ily
Hi
Assume I have the following function which redimensions an array
Array.prototype.reDimension=function(startIndex, endIndex) {
var newArray1=new Array();
for (var i=0;i<this.length;i++) {
if (i<startIndex0 continue;
if (i>endIndex) break;
newArray[newArray.length]=this;
}
this=newArray;
}
I get an error when when I attempt the following line:
this=newArray;
the error being cannot assign to 'this'.
My question is - How can I change the above function so that its a
function of the Array class, but it changes to instance values that it
refers to?
Im sure this can be done - because the array class has push and pop
methods which internally change the number of elements the array has so
it must be possible for this to be done - the questions is how!?
Assume I have the following function which redimensions an array
Array.prototype.reDimension=function(startIndex, endIndex) {
var newArray1=new Array();
for (var i=0;i<this.length;i++) {
if (i<startIndex0 continue;
if (i>endIndex) break;
newArray[newArray.length]=this;
}
this=newArray;
}
I get an error when when I attempt the following line:
this=newArray;
the error being cannot assign to 'this'.
My question is - How can I change the above function so that its a
function of the Array class, but it changes to instance values that it
refers to?
Im sure this can be done - because the array class has push and pop
methods which internally change the number of elements the array has so
it must be possible for this to be done - the questions is how!?