title: JavaScript How do I filter arrays and its objects
body: <p>I want the differences between the two arrays. The result I'm seeking for this example would be {n:&quot;Rice&quot;, q: 5}. Also, how would I only get specifically only &quot;Rice&quot;? I don't really care about the q:</p>
  <pre><code>let arr = [
  {n:&quot;Chicken&quot;, q: 10},
  {n: &quot;Onion&quot;, q: 2},
  {n:&quot;Fish&quot;, q: 12},]
  
  let other = [
  {n:&quot;Chicken&quot;, q: 24},
  {n: &quot;Onion&quot;, q: 8},
  {n:&quot;Fish&quot;, q: 9},
  {n:&quot;Rice&quot;, q: 5},]
  </code></pre>
  <p>To start with, I tried using this code... but it did the complete opposite, it grabbed everything else but &quot;Rice&quot;.</p>
  <pre><code> let difference = arr.filter(i=&gt;other.find(x=&gt;(x.n !== i.n)));
  </code></pre>