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["
Below is a version of James Coglan's answer in CoffeeScript for those who have abandoned straight JavaScript :)
Object.size = (obj) -> size = 0 size++ for own key of obj size