1、for...in 循环,获取对象的键名
for...in
var array = ['a', 'b', 'c', 'd']; for (let item in array) { console.log(item); // 0 1 2 3 }
2、for...of 循环,获取对象的键值
for...of
var array = ['a', 'b', 'c', 'd']; for (let item of array) { console.log(item); // a b c d }