Answers for "how to replace space with hyphen in javascript"

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 "how to replace space with hyphen in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language