title: How to replace a substring between two indices
body: <p>I want to replace text between two indices in Javascript, something like: </p>
  
  <pre><code>str = "The Hello World Code!";
  str.replaceBetween(4,9,"Hi");
  // outputs "The Hi World Code"
  </code></pre>
  
  <p>The indices and the string are both dynamic.</p>
  
  <p>How could I go about doing this?</p>