title: How to check whether multiple values exist within an Javascript array
body: <p>So, I'm using Jquery and have two arrays both with multiple values and I want to check whether <strong>all</strong> the values in the first array exist in the second.</p>
  
  <p>For instance, example 1...</p>
  
  <blockquote>
    <p>Array A contains the following values</p>
    
    <p>34, 78, 89</p>
    
    <p>Array B contains the following values</p>
    
    <p>78, 67, 34, 99, 56, 89</p>
    
    <p>This would return <strong>true</strong></p>
  </blockquote>
  
  <p>...example 2:</p>
  
  <blockquote>
    <p>Array A contains the following values</p>
    
    <p>34, 78, 89</p>
    
    <p>Array B contains the following values</p>
    
    <p>78, 67, 99, 56, 89</p>
    
    <p>This would return <strong>false</strong></p>
  </blockquote>
  
  <p>...example 3:</p>
  
  <blockquote>
    <p>Array A contains the following values</p>
    
    <p>34, 78, 89</p>
    
    <p>Array B contains the following values</p>
    
    <p>78, 89</p>
    
    <p>This would return <strong>false</strong></p>
  </blockquote>
  
  <p>So far I have tried to solve this by:</p>
  
  <ol>
  <li>Extending <a href="https://stackoverflow.com/questions/1773069/using-jquery-to-compare-two-arrays">Jquery with a custom 'compare' method</a> to compare the two arrays. Problem is this only returns <strong>true</strong> when the arrays are identical and as you can see from example 1 I want it to return true even if they aren't identical but at least contain the value</li>
  <li>using <a href="http://api.jquery.com/jQuery.inArray/" rel="noreferrer">Jquerys .inArray function</a>, but this only checks for one value in an array, not multiple.</li>
  </ol>
  
  <p>Any light that anyone could throw on this would be great.</p>