Answers for "string replace dash and space js"

7

javascript replace spaces with dashes

title = title.replace(/\s/g , "-");
Posted by: Guest on August-24-2020
1

javascript replace all spaces with dashes

let originalText = 'This is my text';
let dashedText = originalText.replace(/ /g, '-');
Posted by: Guest on December-04-2020

Code answers related to "string replace dash and space js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language