new empty object javascript code example
Example 1: javascript check if object is empty
function isObjectEmpty(obj) {
return Object.keys(obj).length === 0;
}
Example 2: declare empty object javascript
var objectA = {} //This is an object literal // NB: Preferred Way
var objectB = new Object() //This is the object constructor
Example 3: how to initialize empty javascript object
let obj = {};