A code unit is the basic component used by a character encoding system (such as UTF-8 or UTF-16). A character encoding system uses one or more code units to encode a Unicode code point.
For example, sometimes characters with diacritics such as accents are represented using two Unicode code points:
const myString = 'ñ'; myString.length; // 2
Also, since not all of the code points defined by Unicode fit into 16 bits, many Unicode code points are encoded as a pair of UTF-16 code units, which is called a surrogate pair:
const face = '🥵'; face.length; // 2
const face = '🥵'; face.codePointAt(0) // 129397