js number of elements in object code example
Example 1: javascript get number of elements in object
Object.keys(obj).length
Example 2: js obj getting count of properties
let count = 0;
for (let k in myobj) if (myobj.hasOwnProperty(k)) count++;
Object.keys(obj).length
let count = 0;
for (let k in myobj) if (myobj.hasOwnProperty(k)) count++;