Question : convert/replace space to dash/hyphen javascript
Answered by : sagor-mahtab
var 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
Question : replace space with hyphen/dash javascript
Answered by : sagor-mahtab
const 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
Question : javascript replace dash with space
Answered by : friendly-frog-tqciuyft6zd3
let str = "This-is-a-news-item-";
str = str.replace(/-/g, ' ');
alert(str);
Source : https://stackoverflow.com/questions/14262770/javascript-replace-dash-hyphen-with-a-space | Last Update : Wed, 26 Aug 20