JavaScript Periksa apakah objek kosong
function isObjectEmpty(obj) {
return Object.keys(obj).length === 0;
}
Grepper
function isObjectEmpty(obj) {
return Object.keys(obj).length === 0;
}
> !!Object.keys(obj).length;
Object.entries(objectToCheck).length === 0
if (typeof value !== 'undefined' && value) {
//deal with value'
};