title: How to create an object from an Array of key-value pairs?
body: <p>In Python one can pass the <code>dict</code><sup>1</sup> constructor a sequence of key-value pairs:</p>
  
  <pre><code>&gt;&gt;&gt; dict([['name', 'Bob'], ['age', 42], ['breakfast', 'eggs']])
  {'age': 42, 'name': 'Bob', 'breakfast': 'eggs'}
  </code></pre>
  
  <p>I can't think of any way to do this sort of thing in JavaScript other than defining my own function for the purpose:</p>
  
  <pre><code>function pairs_to_object(pairs) {
      var ret = {};
      pairs.forEach(function (p) { ret[p[0]] = p[1]; });
      return ret;
  }
  </code></pre>
  
  <p>But I'm a JS noob...  Is there anything built-in for this sort pairs-to-object conversion?</p>
  
  <p><sub><sup>1</sup> For the purposes of this question, I'm treating Python dicts as Python's counterpart of JS objects, although, of course the similarity is limited only to the fact that they are both key-value collections.</sub></p>