Upon examining this code snippet, the apparent logic seems to be as follows:
Three empty arrays are created. One value is added to bankSelectedData and its length is printed out. Then a line of code sets bankSelectionArrayPrevious equal to bankSelectionArrayCurrent. However, even after this assignment, when checking the size of bankSelectionArrayPrevious, it still displays '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);
}
If you have any insights or guidance on how this issue can arise, I'd appreciate it!