
Camila Waz
发布于
2020-04-28 20:22:11
es6 for...in循环和for...of循环
上一篇文章:
使用扩展运算符(...)将Map 转为数组
下一篇文章:
es6 find()用于找出第一个符合条件的数组成员
var array = ['a', 'b', 'c', 'd'];1、for...in循环,获取对象的键名
for (let item in array) { console.log(item); // 0 1 2 3 }2、for...of循环,获取对象的键值
for (let item of array) { console.log(item); // a b c d }
最后生成于 2020-12-28 15:07:48
上一篇文章:
使用扩展运算符(...)将Map 转为数组
下一篇文章: