当前位置:网站首页>js变量提升(hoisting)
js变量提升(hoisting)
2022-07-01 09:14:00 【su27_0101】
变量提升 又叫变量声明 提升到 当前所在作用域 最前面
如:
var a = 5;
function fn(){
a; // undefined
var a = 6;
a; // 6
}
fn();
为何 函数 内 第一个 a = undefined
我们可以借用变量提升的规则转写为
function fn(){
var a = undefined;
a; // undefined
a = 6;
a; // 6
}
这样是否就十分清晰 js 会将 函数或变量声明 默认提升到当前作用域最前面,而以上例子当前的作用域为函数fn
边栏推荐
- PR training notes
- Shell script - string
- I use flask to write the website "one"
- OSPF - virtual link details (including configuration commands)
- 3D打印Arduino 四轴飞行器
- 【pytorch】2.4 卷积函数 nn.conv2d
- Principle and application of single chip microcomputer timer, serial communication and interrupt system
- 如何高效拉齐团队认知
- [pytorch learning] torch device
- 通过 代码实例 理解 浅复制 与 深复制
猜你喜欢
jeecg 重启报40001
Design and manufacture of simple digital display electronic scale
2.2 【pytorch】torchvision. transforms
How to manage fixed assets efficiently in one stop?
Reproduced Xray - cve-2017-7921 (unauthorized access by Hikvision)
[pytorch] softmax function
MySQL optimization
Jetson nano installs tensorflow GPU and problem solving
Ape anthropology topic 20 (the topic will be updated from time to time)
Nacos service configuration and persistence configuration
随机推荐
Log4j log framework
[ESP nanny level tutorial] crazy completion chapter - Case: ws2812 light control system based on Alibaba cloud, applet and Arduino
Key points of NFT supervision and overseas policies
队列的实现和应用
安装Oracle EE
Performance improvement 2-3 times! The second generation Kunlun core server of Baidu AI Cloud was launched
2.3 【pytorch】数据预处理 torchvision.datasets.ImageFolder
dsPIC30F6014a LCD 方块显示
【pytorch】transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))
Win7 pyinstaller reports an error DLL load failed while importing after packaging exe_ Socket: parameter error
nacos简易实现负载均衡
It technology ebook collection
Log4j 日志框架
JCL 和 SLF4J
Redis——Lettuce连接redis集群
【pytorch】nn.AdaptiveMaxPool2d
Shell脚本-字符串
3D printing Arduino four axis aircraft
韦东山板子编译内核问题解决
【ESP 保姆级教程 预告】疯狂Node.js服务器篇 ——案例:ESP8266 + MQ系列 + NodeJs本地服务 + MySql存储