当前位置:网站首页>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
边栏推荐
- NoSQL数据库的安装和使用
- [ESP nanny level tutorial] crazy completion chapter - Case: gy906 infrared temperature measurement access card swiping system based on the Internet of things
- Flink interview questions
- Shell script echo command escape character
- Shell script -while loop explanation
- Win7 pyinstaller reports an error DLL load failed while importing after packaging exe_ Socket: parameter error
- LeetCode 344. Reverse string
- 2.3 【pytorch】数据预处理 torchvision.datasets.ImageFolder
- Daily office consumables management solution
- Class loading
猜你喜欢

Installation and use of NoSQL database

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

Mysql 优化

TV size and viewing distance
![2.3 [pytorch] data preprocessing torchvision datasets. ImageFolder](/img/19/cce8d8a7cdcb1021166c46adf803c1.png)
2.3 [pytorch] data preprocessing torchvision datasets. ImageFolder

PR training notes

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

How to manage fixed assets well? Easy to point and move to provide intelligent solutions

Learning practice: comprehensive application of cycle and branch structure (II)

Redis -- lattice connects to redis cluster
随机推荐
[pytorch] softmax function
Mysql 优化
Learning practice: comprehensive application of cycle and branch structure (II)
js原型陷阱
Bird recognition app
PR training notes
MapReduce编程基础
jeecg 重启报40001
[pytorch learning] torch device
Youqitong PE toolbox [vip] v3.7.2022.0106 official January 22 Edition
2022.02.15_ Daily question leetcode six hundred and ninety
Principle and application of single chip microcomputer timer, serial communication and interrupt system
Log4j 日志框架
LeetCode 344. Reverse string
Serialization, listening, custom annotation
【pytorch】softmax函数
Graduation season, I want to tell you
The fixed assets management system enables enterprises to dynamically master assets
I use flask to write the website "one"
序列化、监听、自定义注解