title: How can I find matching values in two arrays?
body: <p>I have two arrays, and I want to be able to compare the two and only return the values that match. For example both arrays have the value <code>cat</code> so that is what will be returned. I haven't found anything like this. What would be the best way to return similarities? </p>
  
  <pre><code>var array1 = ["cat", "sum","fun", "run"];
  var array2 = ["bat", "cat","dog","sun", "hut", "gut"];
  
  //if value in array1 is equal to value in array2 then return match: cat
  </code></pre>