问题是:Chrome会自动对对象的属性进行排序.
如果我有一个像这样的对象:
var obj = {4: "first", 2: "second", 1: "third"};
Run Code Online (Sandbox Code Playgroud)
然后我下次做的时候:
for(var i in obj) {
console.debug(obj[i]);
}
Run Code Online (Sandbox Code Playgroud)
我明白了:
third
second
first
但期望:
first
second
third
| 归档时间: |
|
| 查看次数: |
2969 次 |
| 最近记录: |