【for_of循环】for(let value of target){}循环遍历
- 遍历数组
- 遍历Set
- 遍历Map
- 遍历字符串
- 遍历伪数组
let arr = [1,2,3,4,5,5,6,2];
let arr1 = [];
let set = new Set(arr);
for(let i of set){
console.log(i);
arr1.push(i);
}
console.log(arr1);
let map = new Map([['aaa', 'username', 25], [36, 'age']]);
for(let i of map){
console.log(i);
}