Sitelet https://github.com/BonsaiDen/JavaScript-Garden/issues/339
Skip to content

keywords vs. reserved words #339

Description

@lewisje

TL;DR: In the section titled "undefined and null", "keyword of" should be "reserved word in", and in the section titled "Notation of Keys", all three uses of "keyword" should be "reserved word"; all other uses of "keyword" are good (all in the phrase "new keyword"), because the importance of new in these contexts comes from its use in the language as a keyword, not from being reserved.


MDN is a bit confused on this matter (using the phrase "reserved keywords" and incorrectly stating that of is reserved, unless MDN accepts my revision), but the spec is a bit more clear: Such things as the future reserved word enum and the literals null, false, and true are reserved words, but not keywords, and they still cannot be used as variable names or (before ES5) unquoted property keys.

Furthermore, some words that occupy key positions in language constructs and can therefore be considered "key words" are not reserved at all, like as, of, get, and set; the first two are only key in ES6+, while the other two are used in ES5 shorthand methods.

It also appears, in Microsoft's well-known async-await proposal, that async will not be a reserved word despite occupying a key role in the new async function syntax (although await is in the latest draft spec as a future reserved word).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions