当前位置:网站首页>ES6 decoupling top-level objects from windows
ES6 decoupling top-level objects from windows
2022-07-01 09:17:00 【su27_ 0101】
What is a top-level object
Also called global object Globally accessible objects Such as : window.a = 123 a Is the top-level object
however , In the browser, the top-level object is window self,Node In Chinese, it means global
Top level objects and window The disadvantages of dependence
- Leading to easy abuse of top-level objects , Cause object conflict
Such asYou define a=2Andwindow.a =2It's the same , It automatically becomes a variable mounted on the top-level object - Not conducive to modularity : The idea of modularity is Local definition Just want to expose the least content globally
es6 How to avoid top-level objects and window rely on
- Use
const letAnd Block level action to avoid When declaring variables directly Hang upwindow
let b = 1;
window.b // undefined
边栏推荐
- Reproduced Xray - cve-2017-7921 (unauthorized access by Hikvision)
- 2022.02.15_ Daily question leetcode six hundred and ninety
- dsPIC30F6014a LCD 方块显示
- 韦东山板子编译内核问题解决
- Daily practice of C language - day 80: currency change
- Databinding source code analysis
- Niuke monthly race 22- collect pieces of paper
- 计网01-物理层
- 足球篮球体育比赛比分直播平台源码/app开发建设项目
- 【pytorch】transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))
猜你喜欢

【pytorch】nn. Crossentropyloss() and nn NLLLoss()

Jeecg restart alarm 40001

钓鱼识别app

安装Oracle EE

Phishing identification app

I use flask to write the website "one"

Design and manufacture of simple digital display electronic scale

Redis——Lettuce连接redis集群

计网01-物理层

Why is the Ltd independent station a Web3.0 website!
随机推荐
[interview brush 101] linked list
Shell script case in and regular expressions
SDN_简单总结
Common interview questions for embedded engineers 2-mcu_ STM32
How to solve the problem of fixed assets management and inventory?
2.4 激活函数
3D printing Arduino four axis aircraft
JCL 和 SLF4J
[ESP nanny level tutorial preview] crazy node JS server - Case: esp8266 + MQ Series + nodejs local service + MySQL storage
如何高效拉齐团队认知
2.4 activation function
[ESP nanny level tutorial] crazy completion chapter - Case: gy906 infrared temperature measurement access card swiping system based on the Internet of things
Installing Oracle EE
NiO zero copy
nacos简易实现负载均衡
Tree structure -- binary tree 2 non recursive traversal
MapReduce编程基础
Shell script - definition, assignment and deletion of variables
Ape anthropology topic 20 (the topic will be updated from time to time)
【pytorch】2.4 卷积函数 nn.conv2d