Skip to content

Instantly share code, notes, and snippets.

@Ashkanph
Created April 30, 2017 07:51
Show Gist options
  • Save Ashkanph/7fc195ada157dad16551177deb488957 to your computer and use it in GitHub Desktop.
Save Ashkanph/7fc195ada157dad16551177deb488957 to your computer and use it in GitHub Desktop.
A prototype javascript function to change (replace) a character in a string
String.prototype.replaceAt=function(index, character) {
return this.substr(0, index) + character + this.substr(index+character.length);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment