Continuing the discussion from Input character class whitelisting and blacklisting:
Counting the length of strings with emoji input can be a tricky… Some (not all) emoji are surrogate pairs of unicode characters, meaning Javascript understands them as two characters, not one.
While this is technically correct, it’s sometimes useful (validation, hints etc) to present a string length back to a user in a way that’s meaningful to them (one emoji = one character).
For example…
"Hello 😃😃".length -> 10
"Hello 😃😃".surrogateLength -> 8