var array={name:11111,age:18,xing:"男"}
for(index,xd in array){ // console.log(array[index])
console.log(index)
}报错左侧无效,我想知道正确写法?
1 回答

UYOU
TA贡献1878条经验 获得超4个赞
兄弟,你用for in 而且遍历的是对象不是数组不存在索引,索引是下标吧? 这个应该是key和value的关系,而且只能有一个值你for 与 In之间有两个参数本身就有问题。
添加回答
举报
0/150
提交
取消