This is probably something really simple but I have this multi-dimensional array which holds vital data. At one point in my program I need to copy the array so that I can sort it numerically and display the data, without permanently altering the original array order. I thought okay, create a new array and copy the original array data into it. Here is the code:
MyArrayCopy = new Array();
MyArrayCopy = MyArray;
MyArrayCopy.sort(function (b,a){return b [3] - a [3]});
MyArrayCopy.reverse();
Then I display what’s in MyArrayCopy.
Bizarrely, when I go back to another part of the program I find that the data in the original MyArray has been changed too. Can anyone explain this and suggest how I can get round it?
Boondogger