Liudongge / Work-Notes

记录工作中遇到的问题和总结,便于之后归纳
1 stars 0 forks source link

ES6的学习--待完成 #2

Open Liudongge opened 7 years ago

Liudongge commented 7 years ago

http://www.imooc.com/article/17720?block_id=tuijian_wz

Liudongge commented 6 years ago
let arr = [{key:'001'}, {key:'002'}]
for(let item in arr) console.log(item) // 0  1
for(let item of arr) console.log(item) // {key: "001"} {key: "002"}

for in遍历的是数组的索引 for of遍历的是数组元素值