title: Using Find & ForEach in JS Together
body: <p>I have two arrays called <code>active_filters</code> and <code>cars</code>. I'm working on improving performance and I'm finding that the code below is super heavy and slow. I'm wondering if it's possible to compare x.value and element[0] from cars array without having the outer forEach? I'm super new to this, so appreciate any help! If there's a better way of going about this too, I'm open to suggestions :) Thanks!!!</p>
  
  <pre><code> cars.forEach(function(element) {
      active_filters.find(x =&gt; x.value === element[0].getAttribute("data-location-id"));
   });
  </code></pre>
  
  <p><strong>Update:</strong></p>
  
  <p>My goal is to return whether or not the attribute data-location-id (which is located in the cars array) is located and equal to the value property in the active_filters array.</p>
  
  <p><strong>Sample Data:</strong></p>
  
  <p><strong>Active Filters Array Object</strong></p>
  
  <pre><code>{class: "data-location-id", value: "AD-48.7284-2.3601"}
  {class: "data-location-id", value: "AL-48.726243-2.365247"}
  </code></pre>
  
  <p><strong>Cars Array:</strong></p>
  
  <pre><code>&lt;li data-location-id="ZT-48.8308-2.3567" class="listing"&gt;&lt;/li&gt;
  &lt;li data-location-id="AD-48.7284-2.3601" class="listing"&gt;&lt;/li&gt;
  &lt;li data-location-id="AC-28.7284-2.3601" class="listing"&gt;&lt;/li&gt;
  </code></pre>