title: Simple way to create JavaScript dictionary from Array of Arrays
body: <p>I have a list of lists, each inner list has 2 items. I want to transform it into a dictionary.</p>
  
  <pre><code>const have = [['a', 1], ['b', 2]]
  const want = {'a': 1, 'b': 2}
  </code></pre>
  
  <p>In python I would do </p>
  
  <pre><code>&gt;&gt;&gt; dict([['a', 1], ['b', 2]])
  {'a': 1, 'b': 2}
  </code></pre>
  
  <p>What is the easiest way (1-liner) to achieve this in JavaScript?</p>
  
  <p>The easiest way I can think of is a 2-liner.</p>
  
  <pre><code>const have = [['a', 1], ['b', 2]]
  const want = {}
  have.forEach(([key, value]) =&gt; want[key] = value)
  </code></pre>