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[i] == removalChar) {
			output += insertionChar;
		}
        else {
            output += this[i];
        }
	}
    return output;
}


var test = "Hello-1-2-3";
//alert(test.replace("-"," "));
alert(test.replaceAll("-"," "));