title: Comparing & getting values from two arrays in google script
body: <p>Here is the <a href="https://i.stack.imgur.com/1mG4C.png" rel="nofollow noreferrer">input</a>,</p>
  
  <pre><code>colA = [1,1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,3];
  colB = [1.1 ,1.1 ,1.2 ,1.3, 1.3, 'ab', 2.1, 2.1, 2.2, 2.2, 'ab', 3.1, 3.2, 3.3, 3.3, 3.3, 'ab'];
  </code></pre>
  
  <ul>
  <li>Both the arrays have the same length.</li>
  <li>if there are total 6 '1's in colA then there will be only 6 of the 1s item(1._) in colB.</li>
  </ul>
  
  <p>I want the output in the console to look like:</p>
  
  <pre><code>1, 1.1, count of 1.1 = 2
  1, 1.2, count of 1.2 = 3
  1, 1.3, count of 1.3 = 2
  1, AB,  count of AB  = 1
  2, 2.1, count of 2.1 = 2
  2, 2.2, count of 2.2 = 2
  2, AB,  count of AB  = 2
  .
  .
  .
  //or something like this where I must get these three values.
  </code></pre>
  
  <p>Code:</p>
  
  <pre><code>for(i=0; i &lt; colA.length; i++)
  {
   for(j=0; j &lt; colB.length; j++) 
   {
    // what to do here to compare the values.
   }
  }
  </code></pre>
  
  <p>Should I go with two for loops because I want the code to be really optimized as there is going to be around 10k rows of data.
  Open to any suggestions. Thanks for the help.</p>