Names

A name (an identifier) must start with a Unicode letter, $ or _, and may continue with letters, digits, $ and _. Any script counts as a letter, so 价格 and café are valid, and a Unicode escape such as \u4ef7 spells the same identifier. Names are case-sensitive and cannot be reserved words such as class, for, enum or typeof (strict mode adds let, static, yield and a few more; modules add await), though such words work as property keys.

Valid and invalid variable namesJavaScriptLive
const $price = 9.99, _count = 3;
const 价格 = $price * _count;              // any Unicode letter works
const tag = { class: "btn", for: "email" }; // reserved words are fine as keys
console.log(价格.toFixed(2), \u4ef7\u683c === 价格, tag.class);
for (const src of ["const 2fast = 1;", "const enum = 1;"]) {
  try { eval(src); } catch (e) { console.log(src, "->", e.message); }
}