| for .. in | 遍历得到 key | 可枚举的数据:数组、字符串、对象 |
|---|---|---|
| for .. of | 遍历得到 value | 可迭代的数据:数组、字符串、Set、Map |
是否可枚举: Object.getOwnPropertyDescriptors(obj) -> enumerable: true
是否可迭代: arrSymbol.iterator -> next()
知识点
for await .. of
Promise.all
for await .. of
用于遍历一组 Promise
| for .. in | 遍历得到 key | 可枚举的数据:数组、字符串、对象 |
|---|---|---|
| for .. of | 遍历得到 value | 可迭代的数据:数组、字符串、Set、Map |
是否可枚举: Object.getOwnPropertyDescriptors(obj) -> enumerable: true
是否可迭代: arrSymbol.iterator -> next()
for await .. of
Promise.all
for await .. of
用于遍历一组 Promise