title: Cannot read property 'value' of null at addname
body: <p>I am trying to create four inputs and display all of them after clicking the button. However it returns null. What's wrong with my 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>function addname() {
    for (count = 0; count &lt; 5; count++) {
      var x = " ";
      var inputID = "clientname" + (count + 1);
      x = document.getElementById(inputID).value
    }
  
    var f = "";
    for (var count = 0; count &lt; 5; count++) {
      f += x[count];
    }
  
    document.write(f)
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;input type="text" id="clientname1" /&gt;
  &lt;input type="text" id="clientname2" /&gt;
  &lt;input type="text" id="clientname3" /&gt;
  &lt;input type="text" id="clientname4" /&gt;
  &lt;button onclick="addname()"&gt;&lt;/button&gt;</code></pre>
  </div>
  </div>
  </p>