title: What is the best way to access input in javascript?
body: <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 gener10k() {
    let x = getRndInteger(10000, 100);
    let x1 = getRndInteger(x, 10);
    let x2 = x - x1;
    let higherValue = numberToArray(x1);
    const longiness_higher = higherValue.length;
    let higherInput = document.getElementsByName("higher[]");
    for (var i = 0; i &lt; longiness_higher; i++) {
      higherInput[i].value = higherValue[i].value;
    }
    alert('higherValue ' + x1 + ' ' + higherValue[0] + higherValue[1] + higherValue[2] + higherValue[3] + "higherInput " + higherInput[0] + higherInput[1].value + higherInput[2].value + higherInput[3].value);
  }
  
  function getRndInteger(max, min) {
    return Math.floor(Math.random() * (max - min)) + min;
  }
  
  function getlength(number) {
    return number.toString().length;
  }
  
  function numberToArray(number) {
    let array = number.toString().split("");
    return array.map(x =&gt; parseInt(x));
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;body&gt;
    &lt;div class="inputCoefs"&gt;
      &lt;div class="inputCoef1"&gt;
        &lt;input type="text" name="higher[]" class="coeficientsIn10000" /&gt;
        &lt;input type="text" name="higher[]" class="coeficientsIn10000" /&gt;
        &lt;input type="text" name="higher[]" class="coeficientsIn10000" /&gt;
        &lt;input type="text" name="higher[]" class="coeficientsIn10000" /&gt;
        &lt;input type="text" name="higher[]" class="coeficientsIn10000" /&gt;
      &lt;/div&gt;
      &lt;div class="output"&gt;
        &lt;button class="but" id="checkit" onclick="gener10k();"&gt;DO IT&lt;/button&gt;
      &lt;/div&gt;
    &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  <p>I expected to write particular digits to equivalent input array. But instead, I have undefined variables.  What is the best way to write to input from an array?</p>