Js strict mode Summary (SHARE), js summary and sharing

Source: Internet
Author: User

Js strict mode Summary (SHARE), js summary and sharing

On the homepage, we need to understand the concept of strict mode. Strict mode is a special execution mode, which fixes some language limitations, provides stronger error checks, and enhances the security of the disease. Some functions can be executed in strict mode, such:

Function func (){

'Use strict'

}

You can also perform strict mode on the entire js file, such:

'Use strict'

Function func (){

}

We cannot use this function in the following scenarios:

1. width is not allowed.

 

2. unspecified variables cannot be assigned values.

 

3. Change arguments to a static copy of the parameter.

4. An error is reported for the delete parameter and function name.

 

5. An error is returned when the delete attribute cannot be configured.

 

6. An error is reported when the attribute name of the object is repeated in literal form.

7. Prohibit the octal literal

8. Change eval and arguments to keywords. They cannot be used as variables or function names.

9. Independent eval Scope

This points to null, not a global object, when calling a function (not an object's method call, or modifying this without applying, call, or bind.

If you use apply/call, when null or undefined is passed in, this will point to null or undefined, not a global object.

If you try to modify the non-writable attribute (writable = false), a TypeError is returned when you add the attribute to an object that cannot be extended, rather than ignoring it.

Arguments. caller, arguments. callee is disabled

The above js strict mode Summary (SHARE) is all the content shared by Alibaba Cloud xiaobian. I hope you can give us a reference and support the help house.

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.