Skip to content

strict-mode reserved words

Strict-mode reserved words are identifiers that JavaScript accepts as names in sloppy mode, its default non-strict mode, but rejects in strict mode code.

ECMA-262 reserves six of them, implements, interface, package, private, protected, and public, without giving them any meaning, which keeps them free for possible future features. Strict mode applies to ES modules, class bodies, and any script or function that starts with a "use strict" directive.

In strict mode code, using one of these words to name a variable, function, parameter, or class throws a SyntaxError when the code is parsed. They still work as property names, as in config.private.

Three keywords that do have a meaning follow the same rule. The words let, static, and yield are reserved in all strict mode code. In sloppy mode, let can’t name a let, const, or class declaration, and yield is reserved inside generator functions. The await keyword is reserved by context instead, in ES modules and async functions.

Example

Say a sloppy-mode script keeps its settings in a variable named package. The Node.js REPL runs in sloppy mode, so the name works there:

Language: JavaScript
> const package = { name: "inventory" };
undefined
> package.name
'inventory'

After the same code moves into an ES module, which is always strict, Node.js refuses to load it:

Language: JavaScript Filename: settings.mjs
const package = { name: "inventory" };
console.log(package.name);
Language: Shell
$ node settings.mjs
SyntaxError: Unexpected strict mode reserved word

The error comes from parsing, so no line of the module runs. Renaming the variable, for example to pkg, fixes it, while a property such as settings.package works in both modes.

Have a question about this? Mentor AI can show you examples, compare related terms, and point you to tutorials.


By Leodanis Pozo Ramos • Updated Nov. 19, 2026