title: Remove Duplicate Numbers in 2D Array Javascript
body: <p>I have a 2D array of number arrays like say </p>
  
  <pre><code>nonunique = [[1,2,3][2,3,4][1,5]];
  </code></pre>
  
  <p>I want a 1d array of all the unique keywords. </p>
  
  <pre><code>unique = [1,2,3,4,5];
  </code></pre>
  
  <p>Existing solutions aim at matching the entire arrays rather than just returning a 1d array of numbers. Any shortcuts to this in vanilla javascript?</p>
  
  <p>I tried this reduce function from stackoverflow but it seems to filter some non-duplicate values too.</p>
  
  <pre><code>unique = nonunique.reduce((acc, val) =&gt; acc.concat(val.filter((e)=&gt;acc.includes(val))));
  </code></pre>
  
  <p>It doesn't work properly and I can't figure out how to fix it. I also tried </p>
  
  <pre><code>unique = nonunique.filter(onlyUnique);
  </code></pre>
  
  <p>but filter(onlyUnique) doesn't seem to be available on firefox.</p>