Javascript String replaceAt(startIndex, endIndex, value)

Description

Javascript String replaceAt(startIndex, endIndex, value)


String.prototype.replaceAt = function(startIndex, endIndex, value) {
  var beforeIndex = this.substr(0, startIndex);
  var afterIndex = this.substr(endIndex);

  return beforeIndex + value + afterIndex;
};



PreviousNext

Related