Strings In Depth14 / 18
Up next

Iterate characters

// for...of walks code points, so surrogate pairs stay intact
for (const ch of "a\u20ac") {
  console.log(ch, ch.codePointAt(0));
}
// spread splits a string into an array of characters
const chars: string[] = [..."abc"];
console.log(chars);
What you're solving

for-of iterates code points; spread to array