Edit Object Item with Javascript
<p>I am trying to edit data in an array based upon its id.  Here is my array:</p>

<pre><code>var myCollection = {
"data": [
{ "id":"1", "Name":"John Smiths", "AMT_STD":"1.99"},
{ "id":"2", "Name":"Carlsberg", "AMT_STD":"1.99"},
{ "id":"3", "Name":"Samuel Adams", "AMT_STD":"1.99"}
  ]};
</code></pre>

<p>What I would like to be able to do is create a function that will allow me to find id=1 within the array and then update the value of AMT_STD to 1.00.</p>

<p>From looking at other questions I have managed to add to the array and delete items but I have not yet figured out how to find and then edit and item. </p>

<p>I use the code below to add items:</p>

<pre><code>function Add_Item() {
myCollection.data.push( { "id":"4", "Name":"Fosters", "AMT_STD":"1.99" } );
}
</code></pre>

<p>I use the code below to delete items:</p>

<pre><code>function findAndRemove(array, property, value) {
$.each(array, function(index, result) {
if(result[property] == value) {
array.splice(index, 1);
}    
});
</code></pre>

<p>called by  findAndRemove(myCollection.data, 'id', '1');</p>

<p>I have tried to edit the findAndRemove function as that method can find the item within the array however I cant figure out the syntax to edit the item within the index and was hoping someone could point me in the right direction. </p>
