title: Check two arrays have elements with same values
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/1885557/simplest-code-for-array-intersection-in-javascript">Simplest code for array intersection in javascript</a>  </p>
  </blockquote>
  
  
  
  <p>Let's say I have arrays:</p>
  
  <pre><code>[0,1]
  </code></pre>
  
  <p>and </p>
  
  <pre><code>[1,2,3]
  </code></pre>
  
  <p>I need to verify whether these arrays have common elements, for this case it would be <code>1</code></p>
  
  <p>Using jQuery i check it following way:<br>
  <strong>1.</strong> get length of 1st array<br>
  <strong>2.</strong> get length of 2nd array<br>
  <strong>3.</strong> merge arrays<br>
  <strong>4.</strong> get length of merged array<br>
  <strong>5.</strong> if lenght of merged array not equal lenghts 2 initial arrays,that they have common elements<br></p>
  
  <p>One line code is:</p>
  
  <pre><code>(event2Zone[0].length+event2Zone[1].length)==$.unique($.merge(event2Zone[0].zo,event2Zone[1].zo)).length
  </code></pre>
  
  <p>Is there more standard or gracefull way to do the same operation?</p>