Question : javascript replace spaces with dashes
Answered by : strange-sloth-3xtkvm5llvi5
title = title.replace(/\s/g , "-");
Source : https://stackoverflow.com/questions/2657433/replace-space-with-dash-javascript/2657438 | Last Update : Mon, 31 Aug 20
Question : javascript replace all spaces with dashes
Answered by : vmxes
let originalText = 'This is my text';
let dashedText = originalText.replace(/ /g, '-');
Source : https://javascriptf1.com/snippet/replace-spaces-with-dashes-in-javascript | Last Update : Fri, 11 Dec 20
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