Dev Helpers
← Back

Count grapheme clusters

Count grapheme clusters using Node.js.

Open this example in the interactive library

Source code

const date = new Date("2026-01-02T13:30:00Z");
console.log(
  [...new Intl.Segmenter("en", { granularity: "grapheme" }).segment("a👩‍💻")]
    .length,
);

Sample output

2