ES6: Find an object in an array by one of its properties
<p>I'm trying to figure out how to do this in ES6...</p>

<p>I have this array of objects..</p>

<pre><code>const originalData=[
{"investor": "Sue", "value": 5, "investment": "stocks"},
{"investor": "Rob", "value": 15, "investment": "options"},
{"investor": "Sue", "value": 25, "investment": "savings"},
{"investor": "Rob", "value": 15, "investment": "savings"},
{"investor": "Sue", "value": 2, "investment": "stocks"},
{"investor": "Liz", "value": 85, "investment": "options"},
{"investor": "Liz", "value": 16, "investment": "options"}
];
</code></pre>

<p>..and this new array of objects where I want to add each person's total value of their investment types (stocks, options, savings)..</p>

<pre><code>const newData = [
{"investor":"Sue", "stocks": 0, "options": 0, "savings": 0},
{"investor":"Rob", "stocks": 0, "options": 0, "savings": 0},
{"investor":"Liz", "stocks": 0, "options": 0, "savings": 0}
];
</code></pre>

<p>I loop through originalData and save each property of the "current object" in a let..</p>

<pre><code>for (let obj of originalData) {
   let currinvestor = obj.investor;
   let currinvestment = obj.investment;
   let currvalue = obj.value;

   ..but here I want to find the obect in newData that has the property = currinvestor (for the "investor" key)
   ...then add that investment type's (currinvestment) value (currvalue) 
}
</code></pre>