"Use Strict"

For a long time JavaScript was evolving without compatibility issues. New features were added to the language, but the old functionality did not change.
That had the benefit of never breaking existing code. But the downside was that any mistake or an imperfect decision made by JavaScript creators got stuck in the language forever.
It had been so until 2009 when ECMAScript 5 (ES5) appeared. It added new features to the language and modified some of the existing ones. To keep the old code working, most modifications are off by default. One needs to enable them explicitly with a special directive "use strict".

The directive looks like a string: "use strict" or 'use strict'. When it is located on the top of the script, then the whole script works the “modern” way.

"use strict";

// this code works the modern way
...

Looking ahead let’s just note that "use strict" can be put at the start of a function (most kinds of functions) instead of the whole script. Then strict mode is enabled in that function only. But usually people use it for the whole script.

Please make sure that "use strict" is on the top of the script, otherwise the strict mode may not be enabled.

alert("some code");
// "use strict" below is ignored, must be on the top

"use strict";

// strict mode is not activated

Only comments may appear above "use strict".

There is no directive "no use strict" or alike, that would return the old behavior. Once we enter the strict mode, there’s no return.