title: How to link Html box with Javascript function to give the expected output?
body: <p>I'm trying to <strong>link the input box with id="b"</strong> (which is <strong>inside</strong> the <em>div id="but1"</em> .) <strong>with the JS function</strong>,to give the desired output(<em>which just counts inside an array</em>)..but my junior logic isn't finding any problems in the code,what mistakes did i do?</p>
  
  <p>This is the second time i rewrite all the JS function,and i still can't seem to find what's wrong.</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 alert1() {
  
    let arr = [];
    arr.value = document.getElementById('a');
    let b = document.getElementById('b');
    b.value;
  
    for (let i = 0; i &lt; arr.length; i++) {
      if (arr[i].length &lt;= 10) {
        console.log(arr[i].length + " ", "Mbaroi rasti 1");
        b.value = "Mbaroi rasti 1";
        return b;
      } else if (arr[i].length &gt;= 11 &amp;&amp; arr[i].length &lt;= 12) {
        console.log(arr[i].length + " ", "Mbaroi rasti 2");
        b.value = "Mbaroi rasti 2";
        return b;
      } else if (arr[i].length &gt;= 13) {
        console.log(arr[i].length + " ", "Mbaroi rasti 3");
        b.value = "Mbaroi rasti 3";
        return b;
      }
    }
  }
  
  alert1();</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;body&gt;
  
    &lt;div id="div1" style="text-align:center;"&gt;
      &lt;div id="but1"&gt;
        &lt;button id="button_1" onclick="document.getElementById('b').innerHTML=alert1()"&gt;Calc_bashkesia-1&lt;/button&gt;
        &lt;label&gt;&lt;b&gt;InputBox&lt;/b&gt;&lt;/label&gt;
        &lt;input type="text" id="a" placeholder="Enter Some Input" /&gt;
        &lt;input type="text" id="b" placeholder="Calculation output here" for="a" /&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  
  &lt;/body&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>I expect the button with id="button_1" to output the alert1() callback's calculation at the input box with id="b",but that ain't happening.</p>