当前位置:网站首页>Understanding of closures of JS
Understanding of closures of JS
2022-07-23 11:18:00 【Vivqst】
js The scope of variables of is divided into global variables and local variables , Variables inside a function are called local variables
You can access global variables inside the function , But the variables inside the function cannot be accessed outside the function
Closures can solve the problem that variables inside functions cannot be accessed , And you can hide this variable , No direct external access
Closure : The sub functions inside the function can access the local variables inside the function , So closures are also called functions inside functions
function f1(){
var n=999;
function f2(){
alert(n);
}
return f2;
}
var result = f1();
result(); // 999
边栏推荐
- Scattered notes of machine learning: some concepts and notes
- MySQL syntax (pure syntax)
- Using pytorch to realize the flower recognition classifier based on VGg 19 pre training model, the accuracy reaches 97%
- 【无标题】
- Cell sends SMS asynchronously
- 大厂面试机器学习算法(5)推荐系统算法
- C语言之二分查找法或折半查找法剖析(经典例题,经典解析)
- Spark常见面试问题整理
- 【6.28】
- Master slave synchronization step read / write separation + self encountered error sharing
猜你喜欢
随机推荐
JDBC的学习以及简单封装
初识Flask
The super simple face recognition API can realize face recognition in just a few lines of code
大米商城注册
Copy a project /project in idea
Keras saves the best model in the training process
【无标题】
Install pyGame using CMD
[flink]flink on yarn之flink-conf最简单配置
js的防抖和节流
频谱聚类|拉普拉斯矩阵
2. Analysis of the return value of the startup function
从零开始的pytorch小白使用指北
用getchar清理缓冲区(强烈推荐,C语言易错典型)
字典创建与复制
Uscd pedestrian anomaly data set user guide | quick download
[监控部署实操]基于granfana展示Prometheus的图表和loki+promtail的图表
some、every、find、findIndex的用法
Large scale background export excel cannot be concurrent
systemctl-service服务添加环境变量及模板





![[Doris]配置和基本使用contens系统(有时间继续补充内容)](/img/74/21c5c0866ed6b1bb6f9a1e3755b61e.png)


