title: VueJS2: How to check if array contains specific elements?
body: <p>I have a Vue application with a series of checkboxes that add items to an array when the user selects a checkbox. There are about 6 items that could be selected, however, I need to reveal a <code>&lt;div&gt;</code> if 2 specific items are selected:</p>
  
  <blockquote>
    <p>Example array if all elements are checked:</p>
  </blockquote>
  
  <pre><code>["Apples", "Bananas", "Cucumbers", "Pears", "Peaches", "Strawberries"]
  </code></pre>
  
  <p><strong>But, if ONLY <code>Apples</code> and <code>Pears</code> are checked AND/OR if <code>Apples</code> OR <code>Pears</code> are checked, I need to reveal a <code>div</code> in the view with a set of instructions for the user.</strong></p>
  
  <blockquote>
    <p>I tried this but it didn't work:</p>
  </blockquote>
  
  <pre><code>&lt;div v-if="(selectedProducts.length &lt;= 2) &amp;&amp; ( selectedProducts.includes('Apples') || selectedProducts.includes('Pears') )"&gt;
  ...show mycontent...
  &lt;/div&gt;
  </code></pre>
  
  <blockquote>
    <p>In my vue instance I have initiated the data like so:</p>
  </blockquote>
  
  <pre><code>data: {
      selectedProducts: []
  }
  </code></pre>
  
  <p>What's the correct way to write this logic? Should I use the array.every() method in this case? Thank you.</p>