Can I depend on the following code alerting b
before a
?
var x = {}
x['b'] = 1
x['a'] = 0
for(var i in x) {
alert(i)
}
Are there any major browsers that do not preserve insertion order in a JavaScript Object?
At least one major browser did until recently (I think the V8 engine didn't preserve order).
Can I depend on the following code alerting b before a?
No. The spec says that there is no order.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With