title: How to compare two arrays in jquery
body: <p>I want to compare two arrays and if they are equal, add a new attribute to html.</p>
  
  <p>First my html</p>
  
  <pre><code>&lt;ul class="checkout__delivery-collect-shoplist" data-bind="foreach: currentOptions "&gt;
    &lt;li class="checkout__delivery-collect-shop js-delivery-item active"&gt;
      &lt;h6&gt;&lt;em data-bind="text: label"&gt;Name1&lt;/em&gt;&lt;/h6&gt;
    &lt;/li&gt;
    &lt;li class="checkout__delivery-collect-shop js-delivery-item"&gt;
      &lt;h6&gt;&lt;em data-bind="text: label"&gt;Name2&lt;/em&gt;&lt;/h6&gt;
    &lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>First I am creating new array with text</p>
  
  <pre><code>var arr = [];
  jQuery('em[data-bind="text: label"]').each(function() {
      arr.push(jQuery(this).text().split(';'));
  });
  </code></pre>
  
  <p>Also, I have another array with text</p>
  
  <pre><code>var Managerss = Manager.GlobalData[2].options
  Managerss.filter(x =&gt; x.payment_checkmo === '1').map(x =&gt; x.label);
  </code></pre>
  
  <p>It will give </p>
  
  <pre><code>["Name1", "Name2"]
  0: "Name1"
  1: "Name2"
  length: 2
  __proto__: Array(0)
  </code></pre>
  
  <p>So I first need to compare these arrays and if this true create new attribute <code>data-payment = '0'</code> to <code>li.class checkout__delivery-collect-shop js-delivery-item</code></p>
  
  <p>Example what I want</p>
  
  <pre><code>&lt;ul class="checkout__delivery-collect-shoplist" data-bind="foreach: currentOptions "&gt;
    &lt;li class="checkout__delivery-collect-shop js-delivery-item active" data-payment='0'&gt;
      &lt;h6&gt;&lt;em data-bind="text: label"&gt;Name1&lt;/em&gt;&lt;/h6&gt;
    &lt;/li&gt;
    &lt;li class="checkout__delivery-collect-shop js-delivery-item" data-payment='0'&gt;
      &lt;h6&gt;&lt;em data-bind="text: label"&gt;Name2&lt;/em&gt;&lt;/h6&gt;
    &lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>