Skip to content
Maxim Orlov Logo

Helping Node.js developers write robust applications 🚀

Strict vs Non-Strict Mode in ECMAScript

💡 If you're not using ES Modules (import/export), using "use strict" is still relevant today.

👉🏼 An example of something crazy you can do in sloppy mode.

➡️ var let = 5

Read on the diff between sloppy and strict modes: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode/Transitioning_to_strict_mode#Differences_from_non-strict_to_strict

In non-strict mode you can use a reserved keyword such as let as a variable name. In strict mode the JavaScript compiler throws a SyntaxError.