A
Abdullah Kauchali
Hi folks,
Can one rely on the order of keys inserted into an associative Javascript
array? For example:
var o = new Object();
o["first"] = "Adam";
o["second"] = "Eve";
o["third"] = "Cane";
o["fourth"] = "Abel";
..
..
..
//then
for (var i in o){
alert(i);
}
Is the order in this "for loop" *guaranteed* to be:
first, second, third, fourth?
Also, if the "third" key is deleted, is the order still guaranteed?
I've tested this in IE and Firefox, and it seems to work. I'd be grateful
for any links that indicate this in Javascript standards/specs.
Many thanks & kind regards,
Abdullah
Can one rely on the order of keys inserted into an associative Javascript
array? For example:
var o = new Object();
o["first"] = "Adam";
o["second"] = "Eve";
o["third"] = "Cane";
o["fourth"] = "Abel";
..
..
..
//then
for (var i in o){
alert(i);
}
Is the order in this "for loop" *guaranteed* to be:
first, second, third, fourth?
Also, if the "third" key is deleted, is the order still guaranteed?
I've tested this in IE and Firefox, and it seems to work. I'd be grateful
for any links that indicate this in Javascript standards/specs.
Many thanks & kind regards,
Abdullah