1.字符串可以通过for...of进行遍历字符.
2.遍历器可以识别大于0xFFFF的码点,传统的for无法识别这样的码点
let text = String.fromCodePoint(0x20BB7);
for (let i = 0; i < text.length; i++) {
console.log(text[i]);
}
// " "
// " "
for (let i of text) {
console.log(i);
}
// "
标签:遍历,console,na,padStart,repeat,let,字符串
From: https://www.cnblogs.com/mengyiqwq/p/16795478.html