I have a JavaScript object. Is there a built-in or accepted best practice way to get the length of this object?
const myObject = new Object(); myObject["
Here's how and don't forget to check that the property is not on the prototype chain:
var element_count = 0; for(var e in myArray) if(myArray.hasOwnProperty(e)) element_count++;