title: How to find common elements only between 2 arrays in jquery
body: <pre><code>var array1 = [1, 2, 3, 4, 5, 6];
  var array2 = [1, 2, 3, 4, 5, 6, 7, 8, 9];
  </code></pre>
  
  <p>I have two arrays like above. Now I want to do the following in MVC 4 with jQuery.</p>
  
  <ol>
  <li><p>If every elements of both arrays are equal then show a message/alert. e.g. "All records already existing."</p></li>
  <li><p>If every elements of both the arrays are different then just add them all in a "VAR", e.g. <code>var resultset = ....</code> (where 7,8,9 will stored)</p></li>
  <li><p>If few elements common between two arrays then for the common elements show a message with element, e.g. "Record 1,2,3,4,5,6 are already exists" and add the different elements in "VAR", e.g. <code>var resultset = ....</code> (where 7,8,9 will stored). Both the message and difference elements collection will perform at the same time.</p></li>
  </ol>