当前位置:网站首页>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

边栏推荐
- 3311. Longest arithmetic
- LeetCode
- Download address collection of various versions of devaexpress
- Advanced API (UDP connection & map set & collection set)
- Win 10 find the port and close the port
- Laravel Web框架
- [attribute comparison] defer and async
- [solved] sqlexception: invalid value for getint() - 'Tian Peng‘
- Advanced API (multithreading)
- How to specify the execution order for multiple global exception handling classes
猜你喜欢
![PdfWriter. GetInstance throws system Nullreferenceexception [en] pdfwriter GetInstance throws System. NullRef](/img/65/1f28071fc15e76abb37f1b128e1d90.jpg)
PdfWriter. GetInstance throws system Nullreferenceexception [en] pdfwriter GetInstance throws System. NullRef

【已解决】SQLException: Invalid value for getInt() - ‘田鹏‘

多个全局异常处理类,怎么规定执行顺序

《指環王:力量之戒》新劇照 力量之戒鑄造者亮相

JMeter test result output

C代码生产YUV420 planar格式文件

Common problems in io streams

7.2刷题两个

High concurrency memory pool

dataworks自定義函數開發環境搭建
随机推荐
[Fiddler problem] solve the problem about Fiddler's packet capturing. After the mobile network is configured with an agent, it cannot access the Internet
Advanced API (multithreading 02)
Deep learning parameter initialization (I) Xavier initialization with code
Laravel框架 踩坑(一)
Selenium key knowledge explanation
高并发内存池
Inno Setup 制作安装包
How to specify the execution order for multiple global exception handling classes
“百度杯”CTF比赛 2017 二月场,Web:爆破-1
Download address collection of various versions of devaexpress
Arctic code vault contributor
3311. 最长算术
PdfWriter. GetInstance throws system Nullreferenceexception [en] pdfwriter GetInstance throws System. NullRef
The underlying mechanism of advertising on websites
"Moss ma not found" solution
Recursion, Fibonacci sequence
Book recommendation~
Resttemplate configuration use
POI excel percentage
LeetCode