Javascript - Introduction Strict Mode


Javascript 5 introduced the concept of strict mode.

Strict mode is a different parsing and execution model for JavaScript, where some of the erratic behavior is addressed.

To enable strict mode for an entire script, include the following at the top:

"use strict"; 

This is a pragma that tells supporting JavaScript engines to change into strict mode.

You may specify a function to execute in strict mode by including the pragma at the top of the function body:

function doSomething(){ 
    "use strict"; 
    //function body