Array of Objects add amount for id
<p>My question is how can I proper add values of an a array of object by id a create other array for example, I have:</p>

<pre><code>var array = [{"key":"1","amount":200},{"key":"2","amount":200},{"key":"1","amount":200}];

var resultArray=[{"key":"1","amount":400},{"key":"2","amount":200}]
</code></pre>