JavaScript Identifiers and Reserved Words
Quick answer
A binding connects a name to a value. The name is an identifier. Choose names that communicate what the value means, such as unitPrice instead of x. JavaScript is case-sensitive: price and Price are different names.
How it works
For everyday ASCII names, start with a letter, _ or $; later characters can also be digits. Many Unicode letters are permitted, but the full lexical grammar is broader than this shortcut. A reserved word such as return cannot be a variable name. Some restrictions depend on context (for example strict mode or modules). A space or hyphen is not part of an ordinary identifier.
const price = 8;const Price = 12;console.log(price + Price);Expected output in Node.js:
20The two bindings are independent.
const item2 = 4;const _fee = 3;console.log(item2 + _fee);Expected output in Node.js:
7Both names are valid.
Common mistakes
let 2items = 4; and const return = 1; are intentionally invalid syntax (do not run them as working examples). Prefer items2 and result. An identifier is not a quoted string.
Practice
Rename the two bindings in the second example to ticketCount and serviceFee. Update their uses, then confirm that the output stays 7.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
JavaScript Identifiers and Reserved Words — Knowledge Check
Apply the taught concept and reason about the result.
Which is a valid ordinary ASCII binding name?
What does const cost = 3; const Cost = 4; console.log(cost + Cost); display?
Which name communicates a per-unit price most clearly?
Why is let order total = 5; invalid?
Which statement about Unicode identifiers is correct?