Answers for "convert space to dash/hyphen javascript regex"

0

convert/replace space to dash/hyphen javascript

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

convert space to dash/hyphen javascript regex

let 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 "convert space to dash/hyphen javascript regex"

Code answers related to "Javascript"

Browse Popular Code Answers by Language