I created an array of strings in JS.
arr1 = [];
for (...)
arr1.push('aasfd');
Now I add this array to another array contained in some other object.
arr2 = [];
arr2.push(arr1);
console.log(arr2);
The last log statement shows the expected array.
[
Array[3]
0: "A"
1: "B"
2: "C"
length: 3
__proto__: Array[0]
]
After a while, some event handler gets invoked and it turns out the contents of arr2 are undefined. I am pretty sure that no function in the object containing arr2 is invoked between the two callbacks.
arr2 becomes
[undefined x 1]
No idea where the array arr1 contained within arr2 is getting lost. Am I missing something? How do I debug this error?
I hit a bug in chrome which caused it difficult to debug the problem.
https://bugs.webkit.org/show_bug.cgi?id=35801