title: Overwrite values on exsisting keys in JS
body: <p>Hi I have following objects in an array and they appear like this:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>[{col1:abc}
  {col2:def}
  {col1:ghi}]</code></pre>
  </div>
  </div>
  </p>
  
  <p>What I want to do is if the same key is coming again I should overwrite it so it becomes</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>[{col1:ghi}
  {col2:def}]</code></pre>
  </div>
  </div>
  </p>
  
  <p>instead of appending another key value pair.</p>
  
  <p>I am thinking of something like to overwrite</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>[col1:{col1:ghi}
   col2:{col2:def}]</code></pre>
  </div>
  </div>
  </p>
  
  <p>so that i can easily iterate over them in future.
  Is there any way to put my keys in this way by using map or something similar?</p>
  
  <p>Thank you</p>