Answers for "replace dash with space js"

7

javascript replace spaces with dashes

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

js replace space with dash

// replaces space with '-'
str = str.replace(/ /g, "-");
// or
str = str.split(' ').join('-');
Posted by: Guest on May-11-2021
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
0

replace space with hyphen/dash javascript

const str = "Sonic Free Games";
str = str.replace(/\s+/g, '-').toLowerCase();
console.log(str); // "sonic-free-games"
Posted by: Guest on August-09-2021

Code answers related to "replace dash with space js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language