title: Is array objects subset of array of objects
body: <p>I'm trying to write a function to check if the array of objects is a subset of another array of objects and I want it to return a boolean.</p>
  <p>Here's what I have so far:</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var arr1 = [
      { answer: "dispersed", question: "where_is_your_flare_located" },
      { answer: "continuous", question: "what_frequnecy_of_measurement_do_i_require_to_assess_methane_emissions" }
  ];
  
  var arr2 = [
      { question: 'where_is_your_flare_located', answer: 'dispersed' },
      { question: 'what_frequnecy_of_measurement_do_i_require_to_assess_methane_emissions', answer: 'periodic' },
      { question: 'how_long_is_the_flare_expected_to_be_in_operation', answer: 'n_a' },
      { question: 'am_i_managing_an_existing_flare_or_planning_to_install_a_new_one', answer: 'n_a' },
      { question: 'do_i_have_access_to_assistance_gases', answer: '' },
      { question: 'do_i_have_access_to_purge_gas', answer: '' },
  ];
  
  var compare = arr2.filter(function(o) {
      var resultQuestion = o.question;
      var resultAnswer = o.question;
  
      return arr1.some(function(i) {
          var filterQuestion = i.question;
          var filterAnswer = i.question;
          return ((filterQuestion === resultQuestion) &amp;&amp; (resultAnswer === filterAnswer));
      });
  });
  
  console.log(compare)</code></pre>
  </div>
  </div>
  </p>
  <p>I don't understand what I'm doing wrong.
  I will appreciate any help or explanation.</p>