Thanks for the post! I didn't know that split method and spread operator have different behavior.
I looked at grapheme clusters one step deeper and learned that even ... may give wrong results for complex emojis.
console.log([...'🏳️🌈'].length)// 6 🤔
There is even grapheme splitter library to break strings in characters as expected.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Thanks for the post! I didn't know that
split
method andspread
operator have different behavior.I looked at grapheme clusters one step deeper and learned that even
...
may give wrong results for complex emojis.There is even grapheme splitter library to break strings in characters as expected.