Comment #2 on issue 13865 by michal.vrchota: Unexpected Javascript behaviour
http://code.google.com/p/chromium/issues/detail?id=13865
var x;
var mycars = new Array();
mycars[3] = "Saab";
mycars[1] = "Volvo";
mycars[0] = "BMW";
for (x in mycars)
{
document.write(mycars[x] + "<br />");
}
IE, FF, Safari sort items by the order when the item was added into array
(Saab,
VOlvo, BMW)
however Chrome and other minor browsers sorts items by their index (BMW,
Volvo, Saab)
Therefore there can be iregularities on website, while processing for
example some
JSON data and items are displayed in different order.
Or another example: {"0":"BMW","10000000":"Volvo","100":"Saab"} - how to
iterate it
(without knowing indexes) and keep item order? Regex? :D
--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings
--~--~---------~--~----~------------~-------~--~----~
Automated mail from issue updates at http://crbug.com/
Subscription options: http://groups.google.com/group/chromium-bugs
-~----------~----~----~----~------~----~------~--~---