js的for循环中【for in和for of区别】
1.区别
for in | for of | |
---|---|---|
数组(列表) | 输出下标 | 输出元素 |
Object(字典) | 输出键 | 报错(因为没有实现iterable接口) |
数组Object | 先是数组规则 | 再是Object规则 |
2.python中循环字典拿到的是键
3.v-for中in和of(详见)
https://blog.csdn.net/m0_72357784/article/details/129988099
for in | for of | |
---|---|---|
数组(列表) | 输出下标 | 输出元素 |
Object(字典) | 输出键 | 报错(因为没有实现iterable接口) |
数组Object | 先是数组规则 | 再是Object规则 |
https://blog.csdn.net/m0_72357784/article/details/129988099