JSFiddle - React, Tailwind, and code Playground
JavaScript
String.prototype.replaceAll = function (removalChar, insertionChar) {
var output = "";
for (var i = 0; i < this.length; i++) {
if(this.charAt(i) == removalChar) {
output += insertionChar;
}
else {
output += this.charAt(i);
}
}
return output;
}
var test = "Hello-1-2-3";
//alert(test.replace("-"," "));
alert(test.replaceAll("-"," "));