当前位置:网站首页>什么是作用域和作用域链
什么是作用域和作用域链
2022-07-29 01:23:00 【没有天赋全靠手打】
什么是作用域和作用域链
作用域
对象可以被调用的区域,定义一个变量,变量有效的作用域
a(){
let str = '1';
let fun1 = function(){
let str2 = '2';
console.log(str,str2); // 1 2
}
console.log(str);// 1
console.log(str2); // str2 is not defined
}
上诉 str 的作用域是 a() 内部, str2 是 fun1() 内部
作用域链
调用某个函数或属性时,先在当前作用域寻找,如果找不到则向上父级寻找,直到找到全局作用域为止,这个链式查找 的过程,就是作用域链。
边栏推荐
- [the road of Exile - Chapter 4]
- [WesternCTF2018]shrine
- What is browser fingerprint recognition
- Force deduction brush question (2): sum of three numbers
- Sword finger offer special assault edition day 13
- E-commerce keyword research helps data collection
- LM13丨形态量化-动量周期分析
- (arxiv-2018) reexamine the time modeling of person Reid based on video
- 数学建模——派出所选址
- 使用POI,实现excel文件导出,图片url导出文件,图片和excel文件导出压缩包
猜你喜欢

数学建模——红酒品质分类

Leetcode 113: path sum II

Sigma-DSP-OUTPUT

The basic concept of transaction and the implementation principle of MySQL transaction

(arxiv-2018) 重新审视基于视频的 Person ReID 的时间建模

Mobile communication -- simulation model of error control system based on convolutional code

Mathematical modeling -- the laying of water pipes

Verilog procedure assignment statements: blocking & non blocking
![[the road of Exile - Chapter III]](/img/f8/3d1dfabaacf030450c1576fe543cfa.png)
[the road of Exile - Chapter III]

【Golang】- runtime.Goexit()
随机推荐
Comprehensive explanation of "search engine crawl"
ASCII code table
[golang] network connection net.dial
How to crawl web pages with playwright?
Explanation of yocto project directory structure
Practical experience of Google cloud spanner
Comprehensive analysis of news capture doorway
[circuit design] convert AC AC to DC
Add graceful annotations to latex formula; "Data science" interview questions collection of RI Gai; College Students' computer self-study guide; Personal firewall; Cutting edge materials / papers | sh
Blind separation of speech signals based on ICA and DL
druid. io index_ Realtime real-time query
[the road of Exile - Chapter 8]
[the road of Exile - Chapter 2]
为什么 BI 软件都搞不定关联分析
分布式开发漫谈
Mathematical modeling -- heat conduction of subgrade on Permafrost
Golang startup error [resolved]
Force deduction brush question (2): sum of three numbers
[the road of Exile - Chapter 7]
控制输入框弹出弹窗 和不弹出窗口