You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"Astral plane" characters (those whose code point value >= 0x10000) are supported in ES6 in the following ways:
Iteration over strings correctly produces the code point - console.log(...'a😬c') logs "a" "😬" "c", whereas var str = 'a😬c'; for (var i = 0; i < str.length; i++) { console.log(str[i]) } logs "a" "�" "�" "c".
In that vein, [...'a😬c'].length is the correct value of 3, rather than 'a😬c'.length's incorrect value of 4.
String.codePointAt() lets you receive the correct code point - 'a😬c'.codePointAt(1) is '😬', but 'a😬c'[1] is '�'.
The text was updated successfully, but these errors were encountered:
"Astral plane" characters (those whose code point value >= 0x10000) are supported in ES6 in the following ways:
console.log(...'a😬c')
logs"a" "😬" "c"
, whereasvar str = 'a😬c'; for (var i = 0; i < str.length; i++) { console.log(str[i]) }
logs"a" "�" "�" "c"
.[...'a😬c'].length
is the correct value of 3, rather than'a😬c'.length
's incorrect value of 4.String.codePointAt()
lets you receive the correct code point -'a😬c'.codePointAt(1)
is'😬'
, but'a😬c'[1]
is'�'
.The text was updated successfully, but these errors were encountered: