const obj = {}; const obj2 = { n: 1 }; function isObjectEmpty(object) { for (const key in object) { return !object.hasOwnProperty(key); } return true; } console.log("1", isObjectEmpty(obj)); console.log("2", isObjectEmpty(obj2));