let unit of data 这句是什么意思 是什么用法?
let unit of data 这句是什么意思 是什么用法?
let unit of data 这句是什么意思 是什么用法?
for of 啊 可遍历map,object,array,set string等)用来遍历数据,比如组中的值 。
of 后data是遍历的数据 unit是每一项值
https://zhuanlan.zhihu.com/p/464736496
例如:
let arr = [1, 2, 3, 4, 5];
for (let num of arr) {
console.log(num);
}
输出 1,2,3,4,5
循环
let data = [1, 2, 3, 4, 5];
for (let unit of data) {
console.log(unit); //表示数组每一项
}