title: Group (average) values from two arrays
body: <p>I have 2 arrays with the following data:</p>
  
  <pre><code>Array1 = [A, A, A, A, B, B, B, C, C, C, C, C];    
  Array2 = [4, 2, 4, 6, 3, 9, 6, 5, 4, 6, 2, 8];
  </code></pre>
  
  <p>I want to create 2 new arrays from these values:</p>
  
  <pre><code>Array3 = [A, B, C];    
  Array4 = [4, 6, 5];
  </code></pre>
  
  <p>The values in Array 4 are the averages from Array2.</p>
  
  <p>How should the javascript or jquery code look like to create Array3 and Array4?</p>
  
  <p>edit:</p>
  
  <p>I would like to group the values like this:</p>
  
  <pre><code>Array1      Array2
    A           2
    A           4
  ------------------
    B           2
    B           6
  ------------------
    C           3
    C           6
    C           9
  
       result:
  
  Array3      Array4
    A           3          Average from 2 and 4
    B           4          Avarage from 2 and 6
    C           6          Average from 3, 6 and 9
  </code></pre>