What characters are grouped with Array.from?

后端 未结 3 522
Happy的楠姐
Happy的楠姐 2021-02-03 19:06

I\'ve been playing around with JS and can\'t figure out how JS decides which elements to add to the created array when using Array.from(). For example, the followin

3条回答
  •  死守一世寂寞
    2021-02-03 19:32

    UTF-16 (the encoding used for strings in js) uses 16bit units. So every unicode that can be represented using 15 bit is represented as one code point, everything else as two, known as surrogate pairs. The iterator of strings iterates over code points.

    UTF-16 on Wikipedia

提交回复
热议问题