1 of 6

Code point iteration

Returning numbers instead of strings

2 of 6

let position = 0;

while (position < string.length) {const codePoint = string.codePointAt(position);position += codePoint <= 0xFFFF ? 1 : 2;� doSomething(position, codePoint);

// note: `position` === code unit offset}

3 of 6

for (const symbol of string) {const codePoint = symbol.codePointAt(0);� doSomething(codePoint);

// no `position` (i.e. code unit offset)}

4 of 6

for (const codePoint of string.codePoints()) {� doSomething(codePoint);

// no `position`}

5 of 6

for (const { position, codePoint } of string.codePointEntries()) {� doSomething(position, codePoint);}

6 of 6

Stage 1?