javascript check if object is empty

JavaScript
function isEmptyObject(obj) {
    return !Object.keys(obj).length;
}function isObjectEmpty(obj) {
    return Object.keys(obj).length === 0;
}// because Object.entries(new Date()).length === 0;
// we have to do some additional check
Object.entries(obj).length === 0 && obj.constructor === Objectvar myObj = {}; // Empty Object
if(isEmpty(myObj)) {
    // Object is empty (Would return true in this example)
} else {
    // Object is NOT empty
}

Source

Also in JavaScript: