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

边栏推荐
- The underlying mechanism of advertising on websites
- Operation and maintenance technical support personnel have hardware maintenance experience in Hong Kong
- Discussion on some problems of array
- 萬卷書 - 價值投資者指南 [The Education of a Value Investor]
- Setting up the development environment of dataworks custom function
- [attribute comparison] defer and async
- Advanced API (use of file class)
- 691. Cube IV
- "Moss ma not found" solution
- PHP install composer
猜你喜欢

JMeter JSON extractor extracts two parameters at the same time

Use the jvisualvm tool ----- tocmat to start JMX monitoring

7.2 brush two questions

SecureCRT取消Session记录的密码

File operation serialization recursive copy

PAT甲级真题1166

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

Pits encountered in the use of El checkbox group

Recursion, Fibonacci sequence

Sorting, dichotomy
随机推荐
SecureCRT取消Session记录的密码
In depth analysis of reentrantlock fair lock and unfair lock source code implementation
The education of a value investor
Specified interval inversion in the linked list
Common problems in io streams
Practice of enterprise ab/testing platform
Troubleshooting of high CPU load but low CPU usage
mysql误删root账户导致无法登录
带你全流程,全方位的了解属于测试的软件事故
[set theory] partition (partition | partition example | partition and equivalence relationship)
CentOS php7.3 installing redis extensions
Advanced API (character stream & net for beginners)
树莓派更新工具链
《指環王:力量之戒》新劇照 力量之戒鑄造者亮相
Pits encountered in the use of El checkbox group
Book recommendation~
Operation and maintenance technical support personnel have hardware maintenance experience in Hong Kong
Unit test notes
[set theory] equivalence classes (concept of equivalence classes | examples of equivalence classes | properties of equivalence classes | quotient sets | examples of quotient sets)*
691. Cube IV