JS: Allowed Characters in Identifier

By Xah Lee. Date: . Last updated: .

Allowed characters in JavaScript identifiers

JavaScript identifiers (variable/function names) must:

Math symbols such as ⊕ ° are not allowed.

// U+3B1: GREEK SMALL LETTER ALPHA
const α = 4;

// U+3C6: GREEK SMALL LETTER PHI
const φ = (x) => x + 1;

console.log(φ(α) === 5);
// true
// non-unicode-letter character not allowed

// const ° = Math.PI / 180;
// U+B0: DEGREE SIGN

/*
error: The module's source code could not be parsed: Unexpected character '°' at
*/

Allowed Characters and Case Sensitivity