title: How to update key value in an array of objects?
body: <p>This is what I have so far:</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>var onepage = [{
      name: 'Custom Design',
      hours: 5
    },{
      name: 'Premium Theme',
      hours: 2
    },{
      name: 'SEO',
      hours: 5
    },{
      name: 'Backlink Building',
      hours: 6
    },{
      name: 'Article Writing',
      hours: 7
    },{
      name: 'Copywriting',
      hours: 3
    },{
      name: 'Development',
      hours: 8
    }
  ]
  
  window.onkeyup = keyup;
  
  var numberofPages;
  
  function keyup(e) {
    numberofPages = e.target.value;
    newHours = [];
  
    for (var i = 0; i &lt; onepage.length; i++) {
      var totalHours = numberofPages * onepage[i].hours;
      newHours.push(totalHours);
    }
    console.log(newHours);
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;input type="text" placeholder="Number of Pages" id="pages" value="1"&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>The user inputs # of pages and the it gets multiplied by <code>hours</code> and pushed into the array <code>newHours</code> and from there I want to update the original object array hours. </p>
  
  <p>I'm not sure how to <code>update</code> it, or does it make sense to create a new array of objects?</p>