index.js
function write(arr, str, range) {
  const offset = range[0];
  arr[offset] = str;
  for (let i = offset + 1; i < range[1]; i++) {
    arr[i] = undefined;
  }
}
function write(arr, str, range) {
  const offset = range[0];
  arr[offset] = str;
  for (let i = offset + 1; i < range[1]; i++) {
    arr[i] = undefined;
  }
}
function write ( arr , str , range ) { const offset = range [ 0 ] ; arr [ offset ] = str ; for ( let i = offset + 1 ; i < range [ 1 ] ; i ++ ) { arr [ i ] = undefined ; } }
Write the new string into the range provided without modifying the size of arr. If the size of arr changes, then ranges from the parsed code would be invalidated. Since str.length can be shorter or longer than the range it is overwriting, write str into the first position of the range and then fill the remainder of the range with undefined.  We know that a range will only be written to once. And since the array is used for positioning and then joined, this method of overwriting works.
Write the new string into the range provided without modifying the size of arr . If the size of arr changes then ranges from the parsed code would be invalidated . Since str . length can be shorter or longer than the range it is overwriting write str into the first position of the range and then fill the remainder of the range with undefined . We know that a range will only be written to once . And since the array is used for positioning and then joined this method of overwriting works .