For...Of
- 遍历数组
const array1 = ['a', 'b', 'c'];
for (const element of array1) {
console.log(element);
// a
// b
// c
}
- 遍历字符串
const str = 'abc';
for (const element of str) {
console.log(element);
// a
// b
// c
}
浙公网安备 33010602011771号