QuestenaՎարժանք, որը ցույց է տալիս՝ ինչ կրկնել հաջորդիվ
Հարց 29

A string contains one character outside the Basic Multilingual Plane, represented by a surrogate pair. What does length count for that character?

  1. Zero because it is outside the basic plane
  2. One byte
  3. One code unit
  4. Two code unitsՃիշտ պատասխան

Բացատրություն

The length property counts UTF-16 code units, so this surrogate-pair character contributes two. Counting it as one would measure a Unicode code point or perceived character rather than the string's specified length unit.

Շարունակեք այս թեստով

Սկսել վարժանքը
Հարց 29: A string contains one character outside the Basic… · JavaScript Fundamentals · Questena