List of keywords and reserved words in JavaScript
By Flavio Copes
A reference to all the keywords and reserved words in JavaScript, like await, class and const, that you cannot use as variable identifiers in your code.
This is a list of all the keywords and reserved words in JavaScript. You cannot use them as variable identifiers, because the language claims them for its own syntax.
awaitbreakcasecatchclassconstcontinuedebuggerdefaultdeletedoelseenumexportextendsfalsefinallyforfunctionifimplementsimportininstanceofinterfaceletnewnullpackageprivateprotectedpublicreturnsuperswitchstaticthisthrowtrytruetypeofvarvoidwhilewithyield
What happens if you use one?
You get a syntax error before your code even runs:
const class = 'physics'
// SyntaxError: Unexpected token 'class'
The parser sees class and expects a class declaration, not a variable name. The same happens with function names and parameter names.
Note that reserved words are only off-limits as identifiers. They work fine as property names, because there the context is never ambiguous:
const lesson = { class: 'physics', new: true }
lesson.class //'physics'
Some words are only reserved in strict mode
Words like implements, interface, package, private, protected, public and static are reserved only in strict mode. In old-style sloppy code this is legal:
var private = 'my secret'
Turn on strict mode, and the same line becomes a syntax error:
'use strict'
var private = 'my secret'
// SyntaxError: Unexpected strict mode reserved word
ES modules and class bodies are always in strict mode, so in modern code treat these words as fully reserved. let and yield follow the same rule: reserved in strict mode, tolerated outside it.
await is similar but context-based. It’s reserved inside ES modules and async functions, which today means almost everywhere you write JavaScript.
Words reserved for the future
enum deserves a mention. JavaScript has no enums, but the word is reserved anyway, in case a future version of the language adds them. So you can’t use it either.
What about using?
The Explicit Resource Management proposal adds using and await using declarations, for resources that need cleanup when you are done with them. It is a finished TC39 proposal scheduled for ES2027, and it already runs in Chrome 134+, Firefox 141+ and Node 24+.
using is not a reserved word. It is a contextual keyword, like async or of. The parser treats it as a keyword only at the start of a declaration, so you can still name a variable using:
const using = 'still legal'
Pick another name anyway. Now that using file = open(path) is a declaration, a variable called using will confuse everyone reading your code.
One realistic way reserved words bite you: you write let public = true in a quick script, it works, then you move that code into a module and it breaks with a strict mode error. The fix is to pick a different name from the start, something like isPublic. Avoiding every word on this list, in any mode, keeps your code portable.
Want me to talk about your product? You can sponsor this site.
Related posts about js: