当前位置:网站首页>What is scope and scope chain
What is scope and scope chain
2022-07-29 02:13:00 【No talent, all by hand】
What are scopes and scope chains
Scope
The area where the object can be called , Define a variable , Valid scope of variable
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
}
appeal str The scope of is a() Inside , str2 yes fun1() Inside
Scope chain
When calling a function or property , First look for in the current scope , If it cannot be found, look up the parent , Until the global scope is found , This Chain search The process of , It's the scope chain .
边栏推荐
- MySQL high performance optimization notes (including 578 pages of notes PDF document), collected
- How to find the right agent type? Multi angle analysis for you!
- Promise solves asynchrony
- FPGA实现10M多功能信号发生器
- Leetcode/0 and 1 consecutive subarrays with the same number
- ciscn 2022 华中赛区 misc
- mobile-picker.js
- 2022.7.27-----leetcode.592
- 移动通信——基于卷积码的差错控制系统仿真模型
- 【ONE·Data || 数组堆简单实现及其延伸】
猜你喜欢

Mathematical modeling -- cold proof simulation of low temperature protective clothing with phase change materials

Navigation--实现Fragment之间数据传递和数据共享
![[circuit design] open collector OC output of triode](/img/48/5a111b81f0d99990fbcc5263313c07.jpg)
[circuit design] open collector OC output of triode

(CVPR-2019)选择性的内核网络

How to crawl web pages with playwright?

指针——黄金阶段

Cookie和Session
![[circuit design] convert AC AC to DC](/img/b4/67df7f4555379c63694e89055499bb.jpg)
[circuit design] convert AC AC to DC

TI C6000 TMS320C6678 DSP+ Zynq-7045的PS + PL异构多核案例开发手册(2)

Mathematical modeling -- red wine quality classification
随机推荐
How companies make business decisions -- with the help of data-driven marketing
The solution of reducing the sharpness of pictures after inserting into word documents
Complete collection of common error handling in MySQL installation
IDEA 连接 数据库
Wonderful use of data analysis
Using local cache + global cache to realize user rights management of small systems
Talk about possible problems when using transactions (@transactional)
h5背景音乐通过触摸自动播放
数学建模——带相变材料的低温防护服御寒仿真模拟
Introduction to shared data center agent
Try to understand the essence of low code platform design from another angle
How to crawl web pages with playwright?
Comprehensive use method of C treeview control
Type analysis of demultiplexer (demultiplexer)
Force deduction brush question (2): sum of three numbers
Motionlayout -- realize animation in visual editor
2022年编程语言排名,官方数据来了,让人大开眼界
ciscn 2022 华中赛区 misc
How to find the right agent type? Multi angle analysis for you!
MySQL high performance optimization notes (including 578 pages of notes PDF document), collected