Jump to content

JavaScript/Reserved words

From Wikibooks, open books for an open world




In JavaScript, some tokens (words) have a special semantic (meaning). Therefore they cannot be used as names of variables, functions, classes, etc [1] [2]. Some of them are generally reserved words; others are reserved only in a special context; others are reserved for possible future usage without having a special functionality nowadays; others have been defined in outdated ECMAScript versions of the years 1997 - 99.

The list of such special words as of 2022 follows. For some of the words, we offer further information.

Furthermore, there are predefined methods like forEach(), predefined modules like Math, or predefined objects like BigInt whose names should be avoided also.

References

[edit | edit source]
  1. ECMA: Keywords
  2. MDN: Keywords