规则:数字属性从小到大,字符属性按设定顺序
浏览器:IE11, Chrome 39.0.2171.95 m
(1)一次性初始化
var obj1={
1:1,
b:3,
a:4,
2:2
}
for(var p in obj1){
console.log(p); //1,2 ,b,a
}
(2)单独初始化
var obj2={};
obj2.b=3;
obj2[2]=2
obj2.a=4;
obj2[1]=1;
for(var p in obj2){
console.log(p); //1,2,b,a
}