const personInfo = {
name: ‘张三‘, age: 29, addr: ‘我在这里,等风,也等你‘
};
for (const ss in personInfo) {
console.log(ss); ss的值为 name 、age、addr
}
for...of 用来遍历迭代数组的值
this.str = new Array();
this.str.push(‘15‘);
this.str.push(‘20‘);
this.str.push(‘29‘);
for (const i of this.str) {
console.log(i); i的值为‘15’,‘20’,‘29’
}