I want to make a clone of multidimensional Array so that i can play arround with the clone array without affecting main Array.
I'm using following function to do so:
Array.prototype.clone = function () {
var newArray = new Array(this.length);
for(var i=0; i < this.length; i++ ){
newArray[i] = this[i];
}
return newArray;
};
But problem which is since it is using array prototype so it will clone my all array.so can any body tell me what is the best way of doing this.