Last updated 1 year ago
JS ⟩ value ⟩ primitive ⟩ String ⟩ escape sequence
'\x4A' // 'J' ('\xXX') '\u222B' // '∫' ('\uXXXX') '\u{1F639}' // '😹' ('\u{0 ~ 10FFFF}'}
\xXX …
\xXX
(XX = 00~FF, 2 hex digits)
XX
00
FF
(Basic Latin and Latin-1 Supplement)
(= ISO-8859-1)
U+0000 ~ U+00FF
U+00
\uXXXX
(XXXX= 0000 ~ FFFF, 4 hex digits)
XXXX
0000 ~ FFFF
()
U+0000 ~ U+FFFF
U+
0000
FFFF
\u{X}…\u{XXXXXX}
\u{X}
\u{XXXXXX}
(X…XXXXXX, 1~6 hex digits)
X
XXXXXX
(the entirety of )
U+0000 ~ U+10FFFF
U+000
0
10FFFF
code point(s) are used in escape sequences.
replit ⟩ escape sequence
// ⭐ Basic Latin // '\xXX': XX = 00 ~ FF (0 ~ 255, 2^8 code points) '\x4A', // 'J' '\x7A', // 'z' // ⭐ BMP (Baisc Multilingual Plane / Plane 0) // '\uXXXX': XXXX = 0000 ~ FFFF (0 ~ 65535, 2^16 code points) '\u222B', // '∫' // ⭐ entire Unicode (Plane 0 ~ 16) // '\u{X}' ~ '\u{XXXXXX}': 0 ~ 10FFFF (17 * 2^16 = 1,114,112 code points) '\u{7A}', // 'z' '\u{121}', // 'ġ' '\u{1F639}', // '😹'
other examples:octal escape sequence
String ⟩ escape sequences
Grammar and types ⟩ Using special characters in strings