title: Change key's value in array of objects with javascript?
body: <p>I am building a page that allows customers to change information, which is then passed to the admin team to verify before accepting. I am trying to keep the form dynamic in only passing information that was changed by the customer. I'm using the function below to create an array of objects:</p>
  
  <pre><code>$('input, textarea, select').change(function(){
      var key = $(this).attr('name');
      var obj = {};
      obj[key] = $(this).val();
      myArray.push(obj);
  });
  </code></pre>
  
  <p>Which is working correctly, however today I noticed that when changing the field multiple times it created multiple objects with the same name. </p>
  
  <p>My question is how can I find the key which is dynamic and change the value if it exists in the array?</p>
  
  <p>I tried using:</p>
  
  <pre><code>$.each(myArray, function( key, value ) {
      console.log(key, value);
  });
  </code></pre>
  
  <p>But this outputs the index and then the complete object, I need to find the key of the object and then change the value if it already exists.</p>