Skip to content

Instantly share code, notes, and snippets.

@jorendorff
Last active October 7, 2023 23:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jorendorff/ab5be73bbdcd224b8441540d637a5890 to your computer and use it in GitHub Desktop.
Save jorendorff/ab5be73bbdcd224b8441540d637a5890 to your computer and use it in GitHub Desktop.

11.6.2 Reserved Words

A reserved word is an IdentifierName that cannot be used as an Identifier.

Syntax

ReservedWord :: one of
await break case catch class const continue debugger default delete do
else enum export extends false finally for function if import in
instanceof new null return super switch this throw true try typeof var
void while with yield

NOTE 1 enum is so far unused. It is reserved for use as a keyword in future language extensions.

NOTE 2 The ReservedWord definitions are specified as literal sequences of specific SourceCharacter elements. A code point in a ReservedWord cannot be expressed by a \ UnicodeEscapeSequence.

NOTE 3 In addition to the ReservedWord list, several early error rules constrain the set of IdentifierNames that can serve as Identifiers in a given context. See 12.1.1, 13.3.1.1, 13.7.5.1, and 14.6.1. These rules specify ECMAScript's conditional keywords, IdentifierNames that are sometimes reserved, depending on context. In summary:

  • Although yield and await are ReservedWords, they can serve as Identifiers in some contexts.

  • Several names that are not in the ReservedWord list are nonetheless reserved in strict mode code: let, static, implements, interface, package, private, protected, and public.

  • The names arguments and eval are subject to some restrictions in strict mode code.

  • A few names appear in syntactic productions, but are not reserved at all, and thus can always be used as Identifiers: as, async, from, get, of, set, and target.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment