JavaScript: Unicode Escape Sequence

By Xah Lee. Date: . Last updated: .

You can use escape sequences to represent Unicode char. 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

Unicode escape sequence can be used in:

Within a comment, Unicode escape sequence is ignored.

JavaScript String

βˆ‘ JS in Depth
XAH Β BUY NOW

JS in Depth

JS Obj Ref

DOM


JS in Depth

Basic Syntax

Value Types

Variable

String

Function

Property

Object and Inheritance

Array

Constructor/Class

Iterable 🌟

Misc