The four strict mode of JS preparing for spring recruit

Source: Internet
Author: User

JavaScript rigorous mode (strict mode) is run under strict conditions.

Use strict

In strict mode you cannot use the variable that is not declared

The "Use strict" directive only runs at the beginning of a script or function.

The significance of using strict mode:

To eliminate some of the unsafe code operation, to ensure the security of code operation;

Improve compiler efficiency, increase running speed;

Pave the future for new versions of JavaScript.

Limitations of Strict mode

Non-declared variables are not allowed:

Deleting a variable or object is not allowed.

Deleting functions is not allowed.

Variable names are not allowed:

Octal is not allowed:

Escape characters are not allowed:

You are not allowed to assign a value to a read-only property:

A property that is read with a getter method is not allowed to be assigned a value

Deleting a property that does not allow deletion is not allowed:

The variable name cannot use the "eval" string:

Variable names cannot use the "arguments" string:

The following statements are not allowed:

"Use strict";
With (Math) {x = cos (2)};//ErrorFor Some security reasons, variables created at the scope eval () cannot be called:

The four strict mode of JS preparing for spring recruit

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.