javascript test for empty object

JavaScript
function isObjectEmpty(obj) {
    return Object.keys(obj).length === 0;
}function isEmptyObject(obj) {
    return !Object.keys(obj).length;
}// because Object.entries(new Date()).length === 0;
// we have to do some additional check
Object.entries(obj).length === 0 && obj.constructor === Object// because Object.keys(new Date()).length === 0;
// we have to do some additional check
Object.keys(obj).length === 0 && obj.constructor === Object
Source

Also in JavaScript: