Preview:
function insertInBtwn(chars, d1, d2, insertion) {
  //to use splice to insert, you will need 4 things (the array to work on and 3 parameters):
  //  array of characters (chars)
  chars = chars.split("");
  //  the starting index (leftDelimIndex + 1)
  const leftDelimIndex = chars.indexOf(d1);
  const rightDelimIndex = chars.indexOf(d2);
  //  the range to delete (rightDelimIndex - leftDelimIndex - 1)
  //  the thing to insert (insertion)
  chars.splice(
    leftDelimIndex + 1,
    rightDelimIndex - leftDelimIndex - 1,
    insertion
  );
  return chars.join("");
}
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter