You're looking for codePointAt, perhaps using spread (etc.) to convert back to array and then mapping each of them.
console.log(theString.codePointAt(0)); // 127482
console.log(theString.codePointAt(2)); // 127480
// Note −−−−−−−−−−−−−−−−−−−−−−−−−−^
// It's 2 because the first code point in the string occupies two code *units*
You're looking for
codePointAt, perhaps using spread (etc.) to convert back to array and then mapping each of them.or
or skipping an interim step as Sebastian Simon pointed out via
Array.fromand its mapping callback:Example:
Spread and
Array.fromboth work by using the strings iterator, which works by code points, not code units like most string methods do.