title: Why reply variable is giving index number of greetReply array? I want the value from that array
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>var submit = document.getElementById("submit");
  var value = document.getElementById("value");
  
  var greeting = ['hi', 'hello', 'Hlw', 'hello jii', 'hey', 'helo', 'hi there', 'hey']
  var greetReply = ['hlw', 'kisu na', 'gaan shuni'];
  
  
  submit.addEventListener('click', () =&gt; {
      const reply = Math.floor(Math.random() * greetReply.length); // random reply!
  
      for (let i = 0; i &lt; greeting.length; i++) {
          if(value.value === greeting[i]){
              console.log(reply)
          }
      }
  })</code></pre>
  </div>
  </div>
  </p>