Does the "for…in" loop in Javascript loop through the hashtables/elements in the order they are declared?
(JavaScript中的“ for…in”循环是否按声明的顺序遍历哈希表/元素?)
Is there a browser which doesn't do it in order?(有没有按顺序执行的浏览器?)
The object I wish to use will be declared once and will never be modified.(我希望使用的对象将被声明一次,并且永远不会被修改。)
Suppose I have:
(假设我有:)
var myObject = { A: "Hello", B: "World" };
And I further use them in:
(我进一步将它们用于:)
for (var item in myObject) alert(item + " : " + myObject[item]);
Can I expect 'A : "Hello"' to always come before 'B : "World"' in most decent browsers?
(我是否可以期望在大多数体面的浏览器中,“ A:“ Hello””总是在“ B:“ World””之前?)
ask by chakrit translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…