title: JS: Group array by values in nested array
body: <p>I have an array:</p>
  
  <pre><code>[
    {
      theme: "low battery",
      Number: "S-10",
      components: [ "hardware", "battery" ]
    },
    {
      theme: "bad sync",
      Number: "S-11",
      components: [ "software" ]
    },
    {
      theme: "misc troubles",
      Number: "S-12",
      components: [ "hardware", "software" ]
    }
  ]
  </code></pre>
  
  <p>So i want to group this array by "components" values. In other words, i want to know, how many times does component occures in array. For example:</p>
  
  <pre><code>[
    {
      component: "hardware",
      amount: 2
    },
    {
      component: "software",
      amount: 2
    },
    {    
      component: "battery",
      amount: 1
    }
  ]
  </code></pre>