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

JavaScript Scope & Scope Chain (作用域和作用域链) | 会飞的菜虫 #26

Open
FlyingCaiChong opened this issue Dec 28, 2023 · 0 comments

Comments

@FlyingCaiChong
Copy link
Owner

http://flyingcc.cn/2023/12/29/javascript-scopes/

作用域是什么?JavaScript中的作用域指的是变量的可见性和可访问性.也就是说,程序的哪些部分可以访问该变量,或者该变量在哪里是可见的. 为什么作用域如此重要? 作用域的主要好处是安全性。也就是说,这些变量只能从程序的某个区域访问。使用作用域,我们可以避免程序其他部分对变量的意外修改。 作用域也减少了名称空间冲突。也就是说,我们可以在不同的作用域中使用相同的变量名。

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