This is an empty object:
const emptyObject = {}But how do you check if an object is empty with JavaScript?
By using the Object.entries() function.
Here’s another empty object:
const someObject = {}Now use the Object.entries() function on it:
Object.entries(someObject)To log out the result:
console.log(Object.entries(someObject))
// [] (empty array)If an object is empty the result is an empty array [].