// Chrome 85+
str.replaceAll(val, replace_val);
// Older browsers
str.replace(/val/g, replace_val);
function replaceAll(string, search, replace) {
return string.split(search).join(replace);
}
const output = replaceAll(Url, type, changeType);
//as of August 2020, not supported on older browsers
str.replaceAll("abc","def")