I have 'use-strict' mode in JS enabled implicitly

193 Views Asked by At

It turns out that I have 'use-strict' enabled and I don't know why...

const isStrict = () => !this
console.log( isStrict() );

This code returns me true and I'm testing it in a plain .js file, without dependencies or anything. Maybe an extension could be interfering?

Edit: Okay, I realized that It's running in strict-mode because I was using ES6 Modules

<script type="module" src="main.js" defer ></script>

Didn't know that every ES6 module runs in strict-mode

Should I answer my own question or editing it like this is fine? Sorry, I'm new asking questions here

1

There are 1 best solutions below

0
AudioBubble On

Strict mode is enabled by default when using ES6 Modules. See Strict mode on MDN.

As far as I am aware, there is no way to disable this feature.