Check if object is Empty

Javascript

Check if an object is Empty

Use this function to check if object is empty:

javascript

function isEmpty(object) { return Object.getOwnPropertyNames(object).length === 0 }
Usage example:
const object = {}; isEmpty(object); // true