JavaScript: Unicode Escape Sequence

By Xah Lee. Date: . Last updated: .

Character in string can be represented by a escape sequence. For example, "\u03b1" is the same as "Ξ±".

There are 2 syntax:

\u4_hex_digits
works for character whose codepoint is less than 65536 (that is, 2^16, 16 bits)
\u{4_to_6_hex_digits}
works for any unicode character. (new in ES2015)
console.log( "\u03b1" === "Ξ±"); // true
console.log( "\u{03b1}" === "Ξ±" ); // true
console.log( "\u{1f602}" === "πŸ˜‚" ); // true

If you don't understand unicode, see Unicode Basics: Character Set, Encoding, UTF-8, Codepoint

Unicode escape sequence can be used in:

Within a comment, Unicode escape sequence is ignored.

JavaScript String

BUY
Ξ£JS
JavaScript in Depth

JavaScript in Depth

Basic Syntax

Value Types

Variable

String

Property

Object and Inheritance

Array

Function

Constructor/Class

Iterable 🌟

Misc