title: How to update 2D array with another 2D array matching on an id
body: <p>I have two lists and would like to update one with the other on a matching index.</p>
  
  <pre><code>let cart = [{
    header: some_data,
    items: [{
      id: 7,
      properties: some_props_7,
      time: 12345
    }, {
      id: 19,
      properties: some_props_19,
      time: 13344
    }, {
      id: 24,
      properties: some_props_24,
      time: 14342
    }]
  }, etc.];
  
  let newData = [{
    header: some_data,
    items: [{
      id: 19,
      properties: some_new_props_19,
      time: 17744
    }, {
      id: 24,
      properties: some_new_props_24,
      time: 18342
    }]
  }, etc.];
  </code></pre>
  
  <p>I am iterating over the cart, but am not coming up with an efficient way to update. I think I need another for loop in the "update cart" section, but that seems sub-optimal to me.</p>
  
  <p><code>k</code> is a list of indices </p>
  
  <pre><code>let i = 0, j = 0, l = cart.length;
  for (i = 0; i &lt; l; i++) {
    let m = cart[i]['items'].length;
    for (j = 0; j &lt; m; j++) {
      // update cart index with associated newData matching on id
    }
  }
  </code></pre>
  
  <p>How do I update the header and items data in the cart from a dynamic newData list?</p>