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(φ(α));
// 4
const ° = Math.PI / 180;
// U+B0: DEGREE SIGN

console.log(90 * °);
// 1.5707963267948966

// error: The module's source code could not be parsed: Unexpected character '°'
//   const ° = Math.PI / 180;
//         ~

Allowed Characters and Case Sensitivity