Elements order in a “for (… in …)” loop

后端 未结 9 671
终归单人心
终归单人心 2020-11-21 07:27

Does the \"for…in\" loop in Javascript loop through the hashtables/elements in the order they are declared? Is there a browser which doesn\'t do it in order?
The object

9条回答
  •  借酒劲吻你
    2020-11-21 08:11

    The order cannot be trusted. Both Opera and Chrome return the list of properties unordered.

    
    

    The code above shows B, A, C in Opera and C, A, B in Chrome.

提交回复
热议问题