JS determines empty strings, arrays, and objects
empty string
const string = ''
!string
return truestring.length === 0
return true
empty array
const arr =[]
arr.length === 0
return true
empty object
const obj ={
}
JSON.stringify(obj) === '{}'
return trueObject.keys(obj).length === 0
return true
==================There are better ways to judge, please leave a message to add
Also attached is a comparison chart of all data types