The spec for ECMAScript 2020 says:
A reserved word is an IdentifierName that cannot be used as an identifier.
These are the reserved keywords specified in ECMAScript 2020:
break case catch class const continue debugger default delete do else
export extends false finally for function if import in instanceof new
null return super switch this throw true try typeof var void while with
Keywords which are reserved only in certain contexts:
await yield
Keywords which are reserved only if strict mode is on:
arguments eval let static
There are a few keywords which are not currently used in the spec but are set aside for use as a reserved keyword in future specifications, they are:
enum implements interface package private protected public
Apart from the above there global properties which act as reserved keywords. These are read-only or immutable in global scope:
Infinity NaN undefined
There are also a few keywords like async
which are not reserved and can be used as identifiers.
Fin.
Next post is going to be about strict mode
in javascript.
I have taken up a challenge to post good-to-know stuff in JS for thirty days. Please follow me @zlfnhmd for updates and to show some love❤️❤️❤️
Top comments (0)