🆔identifier
the name of a variable/function/property/label/parameter.
JS ⟩ grammar ⟩ token ⟩ identifier
avoid using reserved word as identifier❗ (at least for variable/function/label)
the property name in dot notation (.) can be a reserved word❗
there are 5 categories of identifier names:
not keywords (always allowed as identifiers):
Math,window,toString,_...keywords:
never allowed as identifiers: reserved word (except
await,yield)contextually allowed as identifiers: namely
await,yield.contextually disallowed as identifiers, in strict mode code::
let,static,implements,interface,package,private,protected,public.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,target.
The term conditional keyword, or contextual keyword, is sometimes used to refer to the keywords that fall in the last 3 categories, and thus can be used as identifiers in some contexts and as keywords in others. 📘ECMA
NaN/Infinity/ undefined are
read-only properties (identifier) of the global object❗
not keywords.
only object's configurable properties are "qualified" for "delete", other identifiers are "unqualified" ( can't delete them❗). 📘 MDN
types of identifiers
unqualified identifier for delete - can't be deleted❗
globalThis - identifier for the global object.
label of a statement
parameter(s) of a function
comparisons
binding of a value
static binding (the value of an identifier is predetermined at compile-time)
dynamic binding (the value of an identifier is not determined until runtime)
part of grammar
the identifier of a function expression is in its own function name scope.
⛔delete of an unqualified identifier in strict mode❗️ - variables can't be deleted❗
⛔ the "
prop" part of dot notation (.) must be an identifier❗
Last updated
Was this helpful?