Open this example in the interactive library
Source code
const segmenter = new Intl.Segmenter("en", { granularity: "grapheme" });
console.log([...segmenter.segment("e\u0301👩💻")].length);
Sample output
2

Open this example in the interactive library
const segmenter = new Intl.Segmenter("en", { granularity: "grapheme" });
console.log([...segmenter.segment("e\u0301👩💻")].length);
2