title: Undefined JavaScript
body: <p>Why do I get undefined in alert() in the following code:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var header = document.getElementById("header");
  var navigationBar = document.getElementById("navigationBar");
  var buttons = document.getElementsByClassName("button");
  
  alert(header.innerWidth);
  alert(navigationBar.innerWidth);</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.header {
    background-color: #263238;
    border-bottom: solid 0.25em #37474F;
    border-radius: 0;
    padding: 0.5em;
    display: block;
  }
  
  .navigationBar {
    display: inline-block;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="header" id="header" align="right"&gt;
    &lt;div class="navigationBar" id="navigationBar"&gt;
  
    &lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>