Function to replace a string value with another

function replaceString(stringReplace, oldString, newString) {
  var re = new RegExp(oldString, "gi");
  return stringReplace.replace(re, newString);
}

Add your comment