Split JavaScript string into array of codepoints? (taking into account “surrogate pairs” but not “grapheme clusters”)

@bobince’s answer has (luckily) become a bit dated; you can now simply use

var chars = Array.from( text )

to obtain a list of single-codepoint strings which does respect astral / 32bit / surrogate Unicode characters.

Leave a Comment

tech