Could you please explain how this piece of code works?
String.prototype.replaceAt = function(index, character) {
return this.substr(0, index) + characte
Suppose you execute "thisisatest".replaceAt(3, "h").
Then...
this.substr(0, index) returns "thi" : ie the first 3 characters of "thisisatest"character returns "h"this.substr(index+character.length) returns "isatest" : ie all characters of "thisisatest", starting at position 4So, when you combine this, you get "thihisatest"