对象遍历
let a = {};
a.bb = '99'
a.cc = '11'
a.dd = '44'
for(x in a){ //x是key
console.log(x); //key
console.log(a[x]); //value
}
数组遍历
let array_a = []
array_a.push()
for(let i = 0; i < 3; i++){
let temp = {}
temp.name = '小明'+i
temp.age = i
array_a.push(temp)
}
for(let x in array_a){ //x是下标
console.log(x);
console.log(array_a[x]);
let ele = array_a[x];
console.log(ele['name']); //两种读取js对象属性的方法
console.log(ele.name);
}