Length of a string
Mar 20, 2023 ยท 3 min read ยท TL;DR '๐ฉโ๐ฉโ๐ฆโ๐ฆ๐ฆ๏ธ๐ง๐ปโโ๏ธ'.length is 21 instead of 3 because JS gives length UTF-16 code units and icons are a combination of more than one of such code units. Use Intl.Segmenter to get the length of rendered graphemes. console.log("๐ฉโ๐ฉโ๐ฆโ๐ฆ๐ฆ๏ธ...
Join discussion