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.
You cannot use reserved words as identifier names.
Avoid using the dollar sign. MSIE version 3.0 and Netscape 2.02 cannot cope with dollar signs in variable names. MSIE version 3.02 cannot tell the difference between one identifier and another when the names only differ in the case of the letters that spell the identifier name.
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
Prev | Home | Next |
Identically equal to (===) | Up | Identifier resolution |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |