Javascript String replaceAt(index, character)

Description

Javascript String replaceAt(index, character)


// Replace at position of string
String.prototype.replaceAt=function(index, character) {
    return this.substr(0, index) + character + this.substr(index+character.length);
}

Javascript String replaceAt(index, character)




String.prototype.replaceAt=function(index, character) {
    return this.substr(0, index) + character + this.substr(index + 1, this.length);
}



PreviousNext

Related