How to update array value javascript?
<p>I have an array of 3 objects of keyValue constructor in javacsript:</p>

<pre><code>  function keyValue(key, value){
    this.Key = key;
    this.Value = value;
  };

  var array = [];
  array.push(new keyValue("a","1"),new keyValue("b","2"),new keyValue("c","3"));
</code></pre>

<p>I also have a function 'Update' which takes <code>keyValue object as parameter</code> and updates the value of that object in the array:</p>

<pre><code>  function Update(keyValue, newKey, newValue)
  {
    //Now my question comes here, i got keyValue object here which i have to 
    //update in the array i know 1 way to do this 

    var index = array.indexOf(keyValue);
    array[index].Key = newKey;
    array[index].Value = newValue; 
  }
</code></pre>

<p>But I want a better way to do this if there is one.</p>
