title: How to perform union or intersection on an array of arrays with Underscore.js
body: <p>I have an array of arrays:</p>
  
  <pre><code>var selected = [[1, 4, 5, 6], [1, 2, 3, 5, 7], [1, 4, 5, 6], [1, 7]];
  </code></pre>
  
  <p>Underscore.js has convenient union and intersection methods but they work on passing each array individually as arguments. </p>
  
  <p>How would I go about it if the number of arrays on which the set operations are to be performed is arbitrary?</p>
  
  <p><a href="https://stackoverflow.com/questions/14723412/how-do-i-find-the-intersection-of-an-array-of-arrays-that-contain-objects-using">This question addresses</a> something similar but it is for an array containing objects.</p>