12.7 Names and Keywords
This standard specifies specific code point additions: U+0024 (DOLLAR SIGN) and U+005F (LOW LINE) are permitted anywhere in an
Syntax
The definitions of the nonterminal
The nonterminal _
via
The sets of code points with Unicode properties “ID_Start” and “ID_Continue” include, respectively, the code points with Unicode properties “Other_ID_Start” and “Other_ID_Continue”.
12.7.1 Identifier Names
Unicode escape sequences are permitted in an \
preceding the \
Two
12.7.1.1 Static Semantics: Early Errors
-
It is a Syntax Error if
IdentifierCodePoint ofUnicodeEscapeSequence is not some Unicode code point matched by theIdentifierStartChar lexical grammar production.
-
It is a Syntax Error if
IdentifierCodePoint ofUnicodeEscapeSequence is not some Unicode code point matched by theIdentifierPartChar lexical grammar production.
12.7.1.2 Static Semantics: IdentifierCodePoints
The
- Let cp be
IdentifierCodePoint ofIdentifierStart . - Return « cp ».
- Let cps be
IdentifierCodePoints of the derivedIdentifierName . - Let cp be
IdentifierCodePoint ofIdentifierPart . - Return the
list-concatenation of cps and « cp ».
12.7.1.3 Static Semantics: IdentifierCodePoint
The
- Return the code point matched by
IdentifierStartChar .
- Return the code point matched by
IdentifierPartChar .
- Return the code point whose numeric value is the MV of
Hex4Digits .
- Return the code point whose numeric value is the MV of
CodePoint .
12.7.2 Keywords and Reserved Words
A keyword is a token that matches fixed width
font, in some syntactic production. The keywords of ECMAScript include if
, while
, async
, await
, and many others.
A reserved word is an if
and while
are reserved words. await
is reserved only inside async functions and modules. async
is not reserved; it can be used as a variable name or statement label without restriction.
This specification uses a combination of grammatical productions and await
and yield
, are unconditionally reserved. Exceptions for await
and yield
are specified in
-
Those that are always allowed as identifiers, and are not keywords, such as
Math
,window
,toString
, and_
; -
Those that are never allowed as identifiers, namely the
ReservedWord s listed below exceptawait
andyield
; -
Those that are contextually allowed as identifiers, namely
await
andyield
; -
Those that are contextually disallowed as identifiers, in
strict mode code :let
,static
,implements
,interface
,package
,private
,protected
, andpublic
; -
Those that are always allowed as identifiers, but also appear as keywords within certain syntactic productions, at places where
Identifier is not allowed:as
,async
,from
,get
,meta
,of
,set
, andtarget
.
The term conditional keyword, or contextual keyword, is sometimes used to refer to the keywords that fall in the last three categories, and thus can be used as identifiers in some contexts and as keywords in others.
Syntax
Per \
An \
els\u{65}
. The
enum
is not currently used as a keyword in this specification. It is a future reserved word, set aside for use as a keyword in future language extensions.
Similarly, implements
, interface
, package
, private
, protected
, and public
are future reserved words in