title: Javascript. Optimal way to join 2 sets of objects like in SQL?
body: <p>Let's assume that we have 2 sets of objects </p>
  
  <pre><code>set1 = [{'id':'1', 'x':'1', 'y':'2'}, {'id':'2', 'x':'2', 'y':'2'}]
  set2 = [{'id':'1', 'z':'1'}, {'id':'2', 'z':'2'}]
  </code></pre>
  
  <p>We want: </p>
  
  <pre><code>set3 = set1.join(set2).on('id'); 
  
  &gt;&gt; set3 
  [{'id':'1', 'x':'1', 'y':'2', 'z':'1'},{'id':'2', 'x':'2', 'y':'2', 'z':'2'}]
  </code></pre>
  
  <p>What's right tools for achieving this functionality? 
  May <a href="http://documentcloud.github.com/underscore/" rel="nofollow"><code>underscore</code></a> help here? </p>