Could you please explain how this piece of code works?
String.prototype.replaceAt = function(index, character) { return this.substr(0, index) + characte
Lets imagine this easy case:
"0123456789". replaceAt(2/*index*/,"000"/*character*/)
Then this happens:
this.substr(0, index/*2*/)//"01" + character //"000" + this.substr(index/*2*/+character.length/*3*/)//"56789"
Output:
0100056789