Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ES6let、const和var的区别 #12

Open
Pieces312 opened this issue Sep 24, 2020 · 0 comments
Open

ES6let、const和var的区别 #12

Pieces312 opened this issue Sep 24, 2020 · 0 comments

Comments

@Pieces312
Copy link
Owner

ES5 var
由于ES5只有全局作用域和函数作用域,所以会出现内层变量覆盖外层变量的情况。使用var声明的变量会出现变量提升的情况。

ES6 let/const
在ES6中,新增let/const声明变量的方法,他们的一个共同点都是声明块级作用域。也就是所有的变量,只有在let/const命令所在的代码块内有效。

文章链接:https://www.juejin.im/post/6854573219450454029

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant