当前位置:网站首页>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
边栏推荐
- 手指点击屏幕就模拟进入F11进入全屏
- 通过 代码实例 理解 浅复制 与 深复制
- 队列的实现和应用
- Key points of NFT supervision and overseas policies
- It technology ebook collection
- Yidian Yidong helps enterprises to efficiently manage equipment and improve equipment utilization
- 3D打印Arduino 四轴飞行器
- TV size and viewing distance
- How to realize the usage of connecting multiple databases in idel
- 【ESP 保姆级教程】疯狂毕设篇 —— 案例:基于阿里云、小程序、Arduino的WS2812灯控系统
猜你喜欢

dsPIC30F6014a LCD 方块显示

【pytorch】softmax函数

Implementation and application of queue

TV size and viewing distance

Structure de l'arbre - - - arbre binaire 2 traversée non récursive

Design and manufacture of simple digital display electronic scale

Ape anthropology topic 20 (the topic will be updated from time to time)

安装Oracle EE
![[pytorch] softmax function](/img/97/b8ae22e8496a77e665d716cb0e9ee3.png)
[pytorch] softmax function

MySQL optimization
随机推荐
pcl_viewer命令
Which method is good for the management of fixed assets of small and medium-sized enterprises?
tensorrt yolov5_ trt. Py comments
2.2 【pytorch】torchvision. transforms
MySQL optimization
Is it safe to dig up money and make new shares
[pytorch learning] torch device
Imitation of Baidu search results top navigation bar effect
How to realize the usage of connecting multiple databases in idel
记一次redis超时
Shell script echo command escape character
dsPIC30F6014a LCD 方块显示
delete和delete[]引发的问题
【pytorch】2.4 卷积函数 nn.conv2d
nacos簡易實現負載均衡
微信小程序 webview 禁止页面滚动,同时又不影响业务内overflow的滚动的实现方式
Win7 pyinstaller reports an error DLL load failed while importing after packaging exe_ Socket: parameter error
Shell脚本-case in语句
序列化、监听、自定义注解
Redis source code learning (29), compressed list learning, ziplist C (II)