I would like to replace a digit in a number (the third, for example), but that replaces the first. Why ?
var x = "1111";
var x = x.replace(x[2],"2");
// output : 2111,
// but I would have liked : 1121
I would like to replace a digit in a number (the third, for example), but that replaces the first. Why ?
var x = "1111";
var x = x.replace(x[2],"2");
// output : 2111,
// but I would have liked : 1121