Question : convert space to dash/hyphen javascript regex
Answered by : sagor-mahtab
let str = "Sonic Free Games";
str = str.replace(/\s+/g, '-').toLowerCase();
console.log(str); // "sonic-free-games"
Source : https://stackoverflow.com/questions/1983648/replace-spaces-with-dashes-and-make-all-letters-lower-case | Last Update : Mon, 16 Aug 21