Empty object

Need to check if a JavaScript object is empty? Use this simple utility function that checks if an object is empty using vanilla JavaScript.

const isObjectEmpty = obj => {
return Object.keys(obj).length === 0

How to use

This function takes a JavaScript object as its only argument and returns true or false by checking if the array length of the object's keys is equal to zero.