JavaScript: Allowed Characters in Identifier

By Xah Lee. Date: . Last updated: .

What is allowed characters in JavaScript identifiers?

JavaScript identifiers (variable/function names) must:

Here is a example you can test:

// α GREEK SMALL LETTER ALPHA codepoint 945, hexadecimal 3b1
const α = 4;
console.log(α);
// ok
// ♥ BLACK HEART SUIT codepoint 9829, hexadecimal 2665
// is not a letter
const ♥ = 3;
// SyntaxError: Invalid or unexpected token

(To search for Unicode, or find a character's codepoint, see: Unicode Search 😄.)

What characters are Unicode Letter?

What Characters Are Unicode Letter

Allowed Characters and Case Sensitivity

BUY
ΣJS
JavaScript in Depth

JavaScript in Depth

Basic Syntax

Value Types

Variable

String

Function

Property

Object and Inheritance

Array

Constructor/Class

Iterable 🌟

Misc