Replace Space With Hyphen Dash Javascript

[Solved] Replace Space With Hyphen Dash Javascript | Php - Code Explorer | yomemimo.com
Question : js replace space with dash

Answered by : vastemonde

// replaces space with '-'
str = str.replace(/ /g, "-");
// or
str = str.split(' ').join('-');

Source : | Last Update : Tue, 18 May 21

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 : javascript replace hyphen with space

Answered by : worried-wombat-23d5lbg9dyoq

let str = "This-is-a-news-item-";
str = str.replace(/-/g, ' ');
alert(str); //This is a news item

Source : https://stackoverflow.com/questions/14262770/javascript-replace-dash-hyphen-with-a-space | Last Update : Sun, 10 Apr 22

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

Answers related to replace space with hyphen dash javascript

Code Explorer Popular Question For Php