JavaScript Periksa apakah objek kosong
function isObjectEmpty(obj) {
return Object.keys(obj).length === 0;
}
Grepper
function isObjectEmpty(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 === Object