JavaScript Identifiers

An Identifier is just a name of something. In JavaScript, identifiers are used to name variables, constants, properties, functions and classes.

A JavaScript identifier must follow these rules.

  • An identifier must begin with a letter, _, $ sign
  • Subsequent characters can be letters, numbers, _, or $ sign
  • Identifiers are case sensitive, NUM is different from num
  • JavaScript reserved word cannot be used as identifier

Following are legal JavaScript identifiers:

i
myVar
first_name
$price
_dummy
num1