🆔identifier

the name of a variable/function/property/label/parameter.

JSgrammartoken ⟩ identifier

(token) the name of a variable / function / property / label / parameter.

  • case-sensitive

  • must begin with

    • letter (a...z, A...Z, or Unicode letters)

    • underscore (_)

    • dollar sign ($)

    • may not start with a digit (0-9)

  • subsequent characters can be digits (0...9).

identifiers

  • registered to respective scope at compile-time.

  • created at the beginning of the scope it belongs to, every time that scope is entered (at runtime).

avoid using reserved word as identifier (at least for variable/function/label)

there are 5 categories of identifier names:

  • not keywords (always allowed as identifiers): Math, window, toString, _ ...

  • keywords:

    • never allowed as identifiersreserved 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

only object's configurable properties are "qualified" for "delete", other identifiers are "unqualified" ( can't delete them). 📘 MDN

Last updated