各浏览器中for in顺序的差异
如下
var obj = { 2:"2", 40:"40", 15:"15" }; for (var k in obj) { console.log(k); };
IE6/7/8/Firefox/Safari:
2
40
15
IE9/Chrome10/Opera11:
2
15
40
即IE9/Chrome10/Opera11中不是按定义时的顺序输出的。for in规则参考ECMAScript5 12.6.4。
相关:
If you cannot hear the sound of the genuine in you, you will all of your life spend your days on the ends of strings that somebody else pulls.