title: Length of a JavaScript object
body: <p>I have a JavaScript object. Is there a built-in or accepted best practice way to get the length of this object?</p>
  <pre><code>const myObject = new Object();
  myObject[&quot;firstname&quot;] = &quot;Gareth&quot;;
  myObject[&quot;lastname&quot;] = &quot;Simpson&quot;;
  myObject[&quot;age&quot;] = 21;
  </code></pre>