var is dead? Then what do we make?

Source: Internet
Author: User

We learned about the use of let and const, and their scope.

But still a lot of people with Var, including me, some people say that Var is dead, we use let also useful const

In fact, Var is not dead, there is its functional category, the use of the variable re-assignment and re-binding. So you can use it well.

Let's talk about the const.

(1) A variable that binds only once

(2) Use of const by default

Let

Local variables for a smaller scope range

Use the inside of the function to further narrow the let's scope of use

Other literature: http://www.infoq.com/cn/articles/es6-in-depth-let-and-const/

var is dead? Then what do we make?

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.