title: Return an array item that doesn't match any item in another array?
body: <p>I have two identical arrays of objects. </p>
  
  <p>I then add an object to one of the arrays at a random index:</p>
  
  <p><code>Arr1 = [{ id: "a" }, { id: "b" }, { id: "c" }]</code></p>
  
  <p><code>Arr2 = [{ id: "a" }, { id: "d" }, { id: "b" }, { id: "c" }]</code></p>
  
  <p>How would I go about comparing the two arrays, extracting that new object from Arr2 and assigning that object to a constant?</p>
  
  <p>This is my best effort:</p>
  
  <pre><code>const newPlan
  if (state.plans.length !== data.allPlansJson.edges.length) {
      data.allPlansJson.edges.map(staticPlan =&gt; {
          state.plans.map(planInState =&gt; {
              planInState !== staticPlan &amp;&amp; newPlan = staticPlan
          })
      })
  }
  </code></pre>
  
  <p>Too add even more context:</p>
  
  <p>I'm getting objects from the array <code>data.allPlansJson.edges</code> and spreading them in my a database collection. I'm then getting all of those objects and putting them back into an array in my redux state.</p>
  
  <p>This function is to detect when there is a new object added to the <code>data.allPlansJson.edges</code> array and execute a redux action that posts this new object to my database collection. </p>