Answers for "javascript replace hyphen with space"

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
0

javascript replace hyphen with space

let str = "This-is-a-news-item-";
str = str.replace(/-/g, ' ');
alert(str); //This is a news item
Posted by: Guest on April-03-2022

Code answers related to "javascript replace hyphen with space"

Code answers related to "Javascript"

Browse Popular Code Answers by Language