Identifier (Definition)

A means of referring uniquely to a variable, property or method.

Variables and functions have unique names. These names are called identifiers.

An identifier is a string of characters, composed of letters, digits or two other special characters ($ and _). An identifier name must begin with a non-digit (that is a letter or underscore). JavaScript is case-sensitive and an identifier spelled with uppercase letters is distinct from one having the same name spelled with lower-case letters.

You should not use any of the reserved keywords as identifier names.

An identifier refers to a variable, property or function and is the user defined way to distinguish one item from another.

Identifiers can be of unlimited length, although for practical purposes, they should be kept to a reasonable length, say 30 to 40 characters at most. The following characters are valid for use in identifiers:

a b c d e f g h i j k l m

n o p q r s t u v w x y z

A B C D E F G H I J K L M

N O P Q R S T U V W X Y Z

0 1 2 3 4 5 6 7 8 9

$ _

Identifiers are case-sensitive. The following all denote different identifiers:

exampleidentifier

exampleIdentifier

ExampleIdentifier

EXAMPLEidentifier

EXAMPLEIDENTIFIER

The dollar sign should be used sparingly and according to the ECMA standard is reserved for use by mechanically generated code.

Warnings:

See also:Digit, function( ... ) ..., int, Internet Explorer, Lexical element, Namespace, Netscape Navigator, Nondigit, Scope chain, Storage duration, String literal, Token, Type, with ...

Cross-references:

ECMA 262 edition 2 - section - 7.5

ECMA 262 edition 3 - section - 7.6

O'Reilly JavaScript Definitive Guide - page - 31

Wrox Instant JavaScript - page - 14