ES6 const usage, es6const usage

Source: Internet
Author: User

ES6 const usage, es6const usage

1,ConstDeclare a read-only constant. Once declared, the constant value cannot be changed.

2,ConstScope andLetThe command is the same: onlyBlock-level scope.

3,ConstThe constants declared by the command are not upgraded.And can only be used after the declared position.

4. ES6:VarCommands andFunctionThe global variable declared by the command is still the attribute of the top-level object,LetCommands,ConstCommands,ClassGlobal variables declared by the command,Does not belong to the attribute of the top-level object. That is to say, starting from ES6, global variables will gradually be decoupled from the attributes of top-level objects.

Let B = 1; // console output undefinedwindow. B

 

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.