check if js object is empty

JavaScript
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 === Objectfunction isEmpty(obj) {    return Object.keys(obj).length === 0;}// because Object.keys(new Date()).length === 0;
// we have to do some additional check
Object.keys(obj).length === 0 && obj.constructor === ObjectJSON.stringify({}) !== '{}';
Source

Also in JavaScript: