title: generate and access a 2d-array with key-value pair using javascript only
body: <p>I want to create an array like:</p>
  
  <pre><code>var fruits[ ]=[ [1] ["Grapes","mango","orange"] , [2] ["banana"], [A] ["Avocado","Apple"] , [P] ["Pear","Papaya","pomegranate","plum"] ];
  </code></pre>
  
  <p>And accordingly I want to access the above array using key value pairing or something like that.</p>
  
  <p>For example, if I have a dropdown with values:</p>
  
  <pre><code>&lt;select&gt;
    &lt;option value="1"&gt;1&lt;/option&gt;
    &lt;option value="2"&gt;2&lt;/option&gt;
    &lt;option value="A"&gt;A&lt;/option&gt;
    &lt;option value="P"&gt;P&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>Depending upon my selection, it should display the respective values using a for loop like if I select option "A" then using the for loop it should display the values corresponding to option A ie. Avocado Apple.</p>
  
  <p>How can I achieve this?</p>