Reserved words are words that have special meaning to JavaScript. Therefore, they cannot be used as variable or function names.
You’ll recognize many of the reserved words from previous chapters, but others will be unfamiliar. Some of the latter group are future reserved words; i.e., it’s expected that they might be used in future editions of ECMAScript. They’re being set aside now so that you won’t have to revise your code when revisions are released.
These words are part of the JavaScript language as of ES3.
This is ES5’s list of reserved words. It’s similar to that of ES3, but given that browsers primarily support ES3, we recommend that you keep both lists in mind.
These (along with the object names used in Appendix A) aren’t officially reserved, but as they are (or may be) part of the JavaScript language, you shouldn’t use them as function or variable names. If you do, abandon all hope; the results will be unpredictable.
In addition, most browsers are case-sensitive, which means that they differentiate between Document
and document
. Internet Explorer is only sometimes case-sensitive, which means that, for example, it may not understand any difference between Document
and document
. Consequently, be aware that just because it works in one browser doesn’t mean that it’ll always work in others. Test, test, test.