566 Part IV: Appendixes
As shown by the examples, special characters can be used in identifiers, particularly _
and $. These are supposed to be reserved for special purposes, such as language
implementation environments, but the reality is that they have been co-opted by JavaScript
practitioners. For example, $() is often a user-defined function that wraps document
.getElementById() in a useful way.
Reserved Words
There are numerous reserved words in JavaScript versions. Generally speaking, reserved
words are reserved from use because they already have a defined meaning in some variant
of JavaScript or a related technology. Reserved words generally are categorized in three
types:
- Language keywords
- Future reserved words
- Words such as object names or related technology keywords
Table A-10 lists the words in the first two categories based upon the JavaScript 1.5
specification combined with Microsoft’s Jscript documentation.
NNOT EOTE Some reserved words related to types not found in JavaScript, like “byte,” are reserved in
some versions of ECMAScript and not others.
abstract else instanceof switch
boolean enum int synchronized
break export interface this
byte extends long throw
case false native throws
catch final new transient
char finally null true
class float package try
const for private typeof
continue function protected val
debugger goto public var
default if return void
delete implements short volatile
do import static while
double in super with
TABLE A-10 Reserved Words in JavaScript 1.5