Javascript: Count occurrencies in array object : <p>If I have an array like this</p>

<pre><code>    var array = [
    {name: "Source_one", alertName: "Alert_1"},
{name: "Source_three", alertName: "Alert_2"},
{name: "Source_one", alertName: "Alert_3"},
{name: "Source_two", alertName: "Alert_3"},
{name: "Source_one", alertName: "Alert_3"},
{name: "Source_one", alertName: "Alert_3"},
{name: "Source_two", alertName: "Alert_1"},
{name: "Source_one", alertName: "Alert_1"},
{name: "Source_two", alertName: "Alert_1"},
{name: "Source_two", alertName: "Alert_2"},
{name: "Source_one", alertName: "Alert_1"},
{name: "Source_two", alertName: "Alert_2"},
{name: "Source_three", alertName: "Alert_3"},
{name: "Source_two", alertName: "Alert_2"},
{name: "Source_two", alertName: "Alert_3"},
{name: "Source_three", alertName: "Alert_1"},
{name: "Source_three", alertName: "Alert_1"},
{name: "Source_one", alertName: "Alert_3"},
{name: "Source_three", alertName: "Alert_2"},
{name: "Source_three", alertName: "Alert_2"},
{name: "Source_two", alertName: "Alert_1"},
{name: "Source_three", alertName: "Alert_3"}
    ]
</code></pre>

<p>how can I do if I want to know how may times each point happens for a single alert?</p>

<p>I would like to create this kind of output:</p>

<pre><code> var output = [
    {name: "Source_one", alertName: "Alert_1", frequency:3},
{name: "Source_one", alertName: "Alert_3", frequency:4},
{name: "Source_two", alertName: "Alert_1", frequency:3},
{name: "Source_two", alertName: "Alert_2", frequency:3},
{name: "Source_two", alertName: "Alert_3", frequency:2},
{name: "Source_three", alertName: "Alert_1", frequency:2},
{name: "Source_three", alertName: "Alert_2", frequency:3},
{name: "Source_three", alertName: "Alert_3", frequency:2}
]
</code></pre>

<p>I really have no clue how to do that. Thanks for your help</p>
