WHAT ARE THE ADVANTAGES AND DISADVANTAGES OF “USE STRICT” KEYWORD IN JS?

What are advantages and disadvantages of “Use Strict” keyword in JS?

“Use Strict” is a new feature introduced in ECMAScript 5. The purpose of “use strict” is to indicate that the code should be executed in “strict mode”. For example, with strict mode, you cannot use undeclared variables.

“use strict”;
display();
function display() {
info = 30; // This will also cause an error
Strict mode helps out in the following ways:
• 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.
Browser support:
• Internet Explorer from version 10.
• Firefox from version 4.
• Chrome from version 13.
• Safari from version 5.1.
• Opera from version 12.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>