Skip to content

Instantly share code, notes, and snippets.

@aneurysmjs
Created December 10, 2019 14:10
Show Gist options
  • Select an option

  • Save aneurysmjs/61fe9ffd1ed9f5e7f950286ff34f2a19 to your computer and use it in GitHub Desktop.

Select an option

Save aneurysmjs/61fe9ffd1ed9f5e7f950286ff34f2a19 to your computer and use it in GitHub Desktop.
function replaceRange(str: string, start: number, end: number, substitute: string): string {
const chunk = substitute.repeat(end - start);
return `${str.substring(0, start)${chunk}${str.substring(end)}`;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment