title: Compare 2 nested arrays to return duplicate arrays
body: <p>I have the following code that doesn't work with nested arrays (it works with simple arrays, though):</p>
  
  <pre><code>var array1 = [["501", 1800, "floorsRegion1", 0], ["502", 1800, "floorsRegion1", 0], ["503", 1800, "floorsRegion1", 0]];
  var array2 = [["501", 1800, "floorsRegion1", 0]];
  
  var duplicatesArray = array1.filter(function(val) {
    return array2.indexOf(val) !== -1;
  });
  console.log(duplicatesArray); // should return [["501", 1800, "floorsRegion1", 0]]; but it doesn't currently
  </code></pre>
  
  <p>If instead of nested arrays, I had simple numbers or strings, it would work and 'duplicatesArray' would contain the dupes.  But JS doesn't compare the whole arrays as values, so my code doesn't work.  </p>
  
  <p>Only the val[0] is essential to compare in those nested arrays, but result array must contain the whole nested arrays for duplicates.  </p>
  
  <p>I found several similar solutions, but they remove the dupes instead of returning an array with those dupes.</p>