var keys = [7925181,"68113227"];
var vals = {"7925181":["68113227"],"68113227":["7925181"]};
var temp = [];
for (var i = 0; i < keys.length; i++) {
temp[keys[i]] = vals[keys[i]];
}
//alert(JSON.stringify(vals).length);
alert(JSON.stringify(temp).length);
After running this script in my Chrome browser, I was surprised to see an output of 340666156 after some time.
This raises the question... how did that happen?
The commented out alert function gives an output of 47. Shouldn't the second alert show a similar result? Isn't temp supposed to be a duplicate of val?
You can find a jsfiddle with the code here:
Additionally, if you want to test browser crashes (Chrome crashed for me), you can add the following snippet at the end:
temp.forEach(function(entry) {
alert(temp);
});
Any thoughts or insights on this issue?