xxxxxxxxxx
// Using split() and join() to trim a string at a dash
let title = "JavaScript-Trim-String";
console.log(title.split("-").join(" "));
// Output: "JavaScript Trim String"
// Using split() and join() to trim a string at a colon
let time = "06:56:08";
console.log(time.split(":").join("."));
// Output: "06.56.08"
// Using split() and join() to trim a string at a slash
let url = "https://www.bing.com\\search?q=javascript+trim+string";
console.log(url.split("\\").join("/"));
// Output: "https://www.bing.com/search?q=javascript+trim+string"