当前位置:网站首页>JS monitors empty objects and empty references
JS monitors empty objects and empty references
2022-07-03 07:17:00 【darabiuz】
- An empty object : Represents an object , It does not contain any properties and methods
- Null reference : Point to null
Example : Both methods can create an empty object , One is the constructor method , And one is object literal representation
let obj = new Object()
let obj1 = {
}
You can't use null To monitor whether it is an empty object , An empty object does not equal null
Use JSON.stringify==’{}' To detect whether the object is empty , Not recommended
utilize object.keys(obj) Get an array of attributes , If the array length is 0, Description is empty object
obtain obj All attributes of ( Excluding the prototype chain ), It is very similar to the previous method
边栏推荐
- 【CMake】CMake链接SQLite库
- On the practice of performance optimization and stability guarantee
- 7.2 brush two questions
- 【已解决】win10找不到本地组策略编辑器解决方法
- 《指环王:力量之戒》新剧照 力量之戒铸造者亮相
- File links cannot be opened or downloaded in Google browser
- 万卷书 - 价值投资者指南 [The Education of a Value Investor]
- Inno setup production and installation package
- Selenium key knowledge explanation
- 萬卷書 - 價值投資者指南 [The Education of a Value Investor]
猜你喜欢
Sorting out the core ideas of the pyramid principle
JMeter test result output
POI excel percentage
Interview questions about producers and consumers (important)
多个全局异常处理类,怎么规定执行顺序
Selenium key knowledge explanation
7.2 brush two questions
My 2020 summary "don't love the past, indulge in moving forward"
Interfaces and related concepts
带你全流程,全方位的了解属于测试的软件事故
随机推荐
C代码生产YUV420 planar格式文件
The underlying mechanism of advertising on websites
Advanced API (batch image Download & socket dialog)
MySQL syntax (basic)
Distributed ID
New stills of Lord of the rings: the ring of strength: the caster of the ring of strength appears
centos php7.3安装redis扩展
4279. Cartesian tree
Common analysis with criteria method
High concurrency memory pool
RestHighLevelClient获取某个索引的mapping
GStreamer ffmpeg avdec decoded data flow analysis
Notes on the core knowledge of Domain Driven Design DDD
20220319
【最詳細】最新最全Redis面試大全(50道)
Advanced API (multithreading)
7.2 brush two questions
LeetCode
Advanced API (use of file class)
Troubleshooting of high CPU load but low CPU usage