What is usage of strict ?

Strict Mode is a new feature in ECMAScript 5 that allows you to place a program, or a function, in a "strict" operating context. This strict context prevents certain actions from being taken and throws more exceptions.

strict mode in javascript:

It catches some common coding bloopers, throwing exceptions.

It prevents, or throws errors, when relatively "unsafe" actions are taken (such as gaining access to the global object).

It disables features that are confusing or poorly thought out.


 "use strict";

x = 3.14;          // cause an error 


  "use strict";

myFunction();


function myFunction() {

y = 3.14;     // y is not declared

}