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["
Use:
var myArray = new Object(); myArray["firstname"] = "Gareth"; myArray["lastname"] = "Simpson"; myArray["age"] = 21; obj = Object.keys(myArray).length; console.log(obj)