async need not be a reserved word, as it can be uniquely identified. The contexts in which it can occur are such as
async function() { } async () => { } obj = { async foo() { } };
All of them could not be analyzed in any other way than to see async as an indication of the async function.
await , on the other hand, could theoretically be used in a type statement
async function foo() { await(1); }
which is ambiguous; await expects a value of 1 , or is it a function called with parameter 1 ? Therefore, await should be a reserved word (inside asynchronous functions, outside, feel free to use it as a variable).
Remember that JavaScript has changed significantly since its inception. Many words were designated as reserved, and then were never used or designated as reserved when, technically, they might not have needed it. The designation of await as a reserved word (inside modules) and not the designation of async as a reserved word are the product of a more mature understanding of the language by its designers.
user663031
source share