title: better way to replace multple substring with dynamic length array?
body: <p>I have a lot of strings and I am replacing "xxx" with elements of an array. These arrays can have different lengths. My code is currently working but I am not sure if this is the best way. How would you do it or would you optimize it?</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 items = [{
      str: 'This is xxx an he is xxx years old ',
      list: ['Frank', '14']
    },
    {
      str: 'xxx and xxx are xxx ',
      list: ['George', 'John', "studying"]
    }
  ]
  
  
  items.forEach(item =&gt; {
    item.list.forEach(s =&gt; {
      item.str = item.str.replace("xxx", s)
    })
    console.log(item.str);
  })</code></pre>
  </div>
  </div>
  </p>