How to Check if an Object is Empty with JavaScript

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:


To log out the result:

// [] (empty array)

If an object is empty the result is an empty array [].

Has this been helpful to you?

You can support my work by sharing this article with others, or perhaps buy me a cup of coffee 😊


Share & Discuss on