js detect an empty object ? {} code example
Example 1: javascript check empty object
function isEmptyObject(obj) {
return !Object.keys(obj).length;
}
Example 2: js check if object is empty
> !!Object.keys(obj).length;
function isEmptyObject(obj) {
return !Object.keys(obj).length;
}
> !!Object.keys(obj).length;