re: 4 Ways to Convert String to Character Array in JavaScript VIEW POST


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.

code of conduct - report abuse