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
}
原文:https://www.cnblogs.com/blogZhao/p/12554313.html