title: Cut out, and replace a part of a string
body: <p>There is a part in my string <code>from, to</code> which I would like to replace to an another string <code>replace_string</code>. My code should work, but what if there is an another part like the returned substring?</p>
  
  <pre><code>var from=10, to=17;
  //...
  
  str = str.replace(str.substring(from, to), replace_string);
  </code></pre>
  
  <hr>
  
  <p>For example:</p>
  
  <pre><code>from=4,to=6
  str = "abceabxy"
  replace_string = "zz"
  </code></pre>
  
  <p>the str should be "abcezzxy"</p>