JavaScript Strict mode (ECMASCRIPT5 new)

Source: Internet
Author: User

JavaScript Strict mode: run under strict conditions

How to: Add ' use strict ' command browser support at top of JavaScript (Internet Explore + +, Firefox 4+, Chrome 13+, Safari 5.1+, Opera 12+)

What are the benefits of strict mode?

1, improve the situation of error;

2, improve the compiler efficiency, increase the speed of the operation;

3. Pave the new version of JavaScript for the future.

What are the restrictions imposed by strict mode?

A) do not allow the use of variables declared

b) Deleting a variable or object is not allowed (the object is also a variable)

c) Delete function is not allowed

d) do not allow variable names

e) Do not allow the use of octal

f) The use of escape characters is not allowed

g) do not allow values to be assigned to read-only properties

h) does not allow assignment of properties read by a getter () method

i) do not allow deleting a property that is not allowed to be deleted

j) Variable names cannot use the "eval" string

k) Variable name cannot use "arguments" string

L) with (Math) {x = cos (2)}; Error

m) prohibit the This keyword from pointing to global objects

JavaScript Strict mode (ECMASCRIPT5 new)

Related Article

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.