title: Function to convert an Array to an Associative array
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/8751034/convert-flat-array-k1-v1-k2-v2-to-object-k1v1-k2v2-in-javascript">Convert flat array [k1,v1,k2,v2] to object {k1:v1,k2:v2} in JavaScript?</a>  </p>
  </blockquote>
  
  
  
  <p>I want to convert an array to an associative array in JavaScript.</p>
  
  <p>For example, given the following input,</p>
  
  <pre><code>  var a = ['a', 'b', 'c', 'd'];
  </code></pre>
  
  <p>I want to get the next associative array as output:</p>
  
  <pre><code>  {'a' : 'b', 'c' : 'd'}
  </code></pre>
  
  <p>How can I do that?</p>