title: why does every not work inside an if statement when I am checking for equality?
body: <p>I am trying to find the common number in two arrays using every. As expected, every does not work when I check for equality inside of my if statement. However, it does work in my second example. Unfortunately, I do not understand why. Can someone explain why the second example works where the first does not? </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>//  Will not work here 
  function findCommonNumbersInArrays(arOne, arTwo) {
    var cm = [];
  
    for (var i = 0; i &lt;= arOne.length; i++) {
      if (arTwo.every(a =&gt; a === arOne[i])) {
        cm.push(arOne[i]);
      }
  
    }
    return cm;
  }
  
  console.log('These are the common numbers: ' + findCommonNumbersInArrays([1, 2, 3, 4, 5], [3, 4, 6, 7, 8]));
  
     
  // Works here 
  function common(arOne, arTwo) {
    var cm = [];
  
    for (var i = 0; i &lt;= arOne.length; i++) {
      if (!arTwo.every(a =&gt; a !== arOne[i])) {
        cm.push(arOne[i]);
      }
    }
  
    return cm;
  }
  
  console.log('These are the common numbers :' + common([1, 2, 3, 4, 5], [3, 4, 6, 7, 8]));</code></pre>
  </div>
  </div>
  </p>