当前位置:网站首页>作用域和作用域链
作用域和作用域链
2022-06-12 20:29:00 【站在桥上烤冷面】
1.作用域
a.什么是:保存一个变量的可用范围
b.js中包括两级作用域 :全局作用域和函数作用域
2.作用域的原理
定义函数时,每个函数身上都会保存全局变量和函数体内部自己创建的变量,
调用函数时,临时创建作用域对象,并将作用域对象保存起来,每用到一个变量,函数首先会在自身查找,如果找不到才会去全局查找,遵循就近原则。函数调用完成后,会清楚在函数体内部创建的变量,所以局部变量在函数调用完成后就不能在用了。
3.作用域链
什么是?保存着一个函数所有可用的作用域对象的链式结构

边栏推荐
- How do indexes match?
- Generate API documents using swagger (go language example)
- What is a hash index?
- Scalars, vectors, arrays, and matrices
- 同时做测试,别人已经年薪20w起,为什么你还在为达到月薪10k而努力?
- Overview of object detection
- 可测性设计学习笔记
- Axure RP 9 for MAC (interactive product prototyping tool) Chinese version
- Deploy etcd cluster in static pod mode
- How can the openwrt package manager image be switched to an alicloud source?
猜你喜欢

Niuke.com: sum of three numbers

Lightroom Ambassador series: capturing nostalgia with MEG loeks

Alipay payment episode 11: monitoring after successful payment callback
![[leetcode 7 solution] integer inversion](/img/72/b358a67eaedda48e1c0aebdaec04a5.jpg)
[leetcode 7 solution] integer inversion

JSP中的监听器

Event distribution mechanism of view

If you master these skills, you can also write a high score resume in the eyes of HR

7 R read / write data

Test prerequisites: recommend a special cross platform app performance test tool!

Centos7 installing PHP
随机推荐
Kyma application connectivity feature introduction
Detect current system language
[leetcode 7 solution] integer inversion
go --- 监控文件变化
登錄mysql
[live streaming] understand the design of d3js and learn how to read the source code.
UVa11991 Easy Problem from Rujia Liu
Alipay payment Episode 12: Crazy God and Feige Alipay payment configuration code (free resources, no thanks for taking them away)
服务端口不通排查
Illustrator tutorial, how to recolor artwork in illustrator?
Lightroom Ambassador series: capturing nostalgia with MEG loeks
What is a federated index?
Bsn-ddc basic network introduction, technical features, unique advantages, application scenarios and platform access
WordPress optimization tutorial makes WordPress open faster
Centos7 installing PHP
设计规则检查约束(set_max_transition、set_max_capacitance)
7 R read / write data
Wechat jsapi payment pit summary
unable to recognize “*.yaml“: no matches for kind “ClusterRole“ in version “rbac.authoriz
How mysterious is "PIP not an internal or external command, nor a runnable program or batch file"