For long time we used naive approach to split strings in JS:
someString.split('');
But popularity of emoji forced us to change this approach - emoji characters (and other non-BMP characters) like π are made of two "characters'.
String.fromCodePoint(128514).split(''); // array of 2 characters; can't embed due to StackOverflow limitations
So what is modern, correct and performant approach to this task?
const str = "ππ€πΈπ";
console.log([...str]);
function split(str){
const arr = [];
for(const char of str)
arr.push(char)
return arr;
}
const str = "ππ€πΈπ";
console.log(split(str));