objIsEmpty
This function checks whether a given JavaScript object is empty.
Parameters
obj: The object to be examined.
Returns
boolean: Returns
true
if the object is empty, andfalse
otherwise.
Examples
const emptyObj = {};
console.log(objIsEmpty(emptyObj)); // Output: true
const nonEmptyObj = { key: 'value' };
console.log(objIsEmpty(nonEmptyObj)); // Output: false
Last updated