🗝️keyword
🚧 施工中
JS ⟩ grammar ⟩ token ⟩ keyword
A keyword is a token that matches IdentifierName (looks like an identifier), but also has a syntactic use. (📘ECMA )
keywords can be divided into:
reserved word: never allowed as identifier (except
await
,yield
)contextually allowed as identifier: namely
await
,yield
.await
- reserved only inside async functions and modules.
contextually disallowed as identifier, in strict mode code:: let,
static
,implements
,interface
,package
,private
,protected
,public
.mostly allowed as identifier, but also appear as keywords within certain syntactic productions, at places where identifier is not allowed:
as
,async
,from
,get
,meta
,of
,set
,target
.
NaN
/Infinity
/ undefined is:
not keyword.
immutable & read-only properties of the global object.
JS doesn't throw any errors if you declare them in the global scope.
avoid using reserved word as identifiers (at least for variable/function) ❗
in dot notation (.), it's OK to use reserved word as property name❗
Last updated