I have this piece of code, when you look at it it would seem that the logic should run as follows:
I create 3 empty arrays, I add one value to bankSelectedData, I print out the values, obviously bankSelectedData is now 1 and bankSelectionArrayCurrent length is 0, but then I say:
bankSelectionArrayPrevious = bankSelectionArrayCurrent;
So I’m turning bankSelectionArrayPrevious into bankSelectionArrayCurrent. When I check the size of bankSelectionArrayPrevious is says ‘1’ ?? How is this possible?
var bankSelectionArrayCurrent = new Array();
var bankSelectionArrayPrevious = new Array();
var bankSelectedData = new Array();
bankSelectedData.push("value1");
alert("bankSelectionArrayCurrent length: "+bankSelectionArrayCurrent.length);
alert("bankSelectedData length: "+bankSelectedData.length);
if(bankSelectedData.length != bankSelectionArrayCurrent.length){
bankSelectionArrayPrevious = bankSelectionArrayCurrent;
bankSelectionArrayCurrent.length = 0
alert("previousSize: "+bankSelectedData.length);
alert("currentSize: "+bankSelectionArrayCurrent.length);
}
Thanks for any advice!
Where you have
perhaps you meant: