title: how to compare two arrays of different length if you dont know the length of each one in javascript?
body: <p>I am stuck in this. I got 2 arrays, I don't know the length of each one, they can be the same length or no, I don't know,  but I need to create a new array with the numbers no common in  just a (2, 10).</p>
  
  <p>For this case:</p>
  
  <pre><code>    var a = [2,4,10];
      var b = [1,4];
  
      var newArray = [];
  
      if(a.length &gt;= b.length ){
          for(var i =0; i &lt; a.length; i++){
              for(var j =0; j &lt; b.length; j++){
                  if(a[i] !=b [j]){
                      newArray.push(b);        
                  }        
              }
          }
      }else{}  
  </code></pre>
  
  <p>I don't know why my code never reach the first condition and I don't know what to do when b has more length than a.</p>