javascript - Replace spaces with dashes and make all letters lower-case - Stack Overflow

PHOTO EMBED

Tue Apr 13 2021 06:14:50 GMT+0000 (Coordinated Universal Time)

Saved by @Jazz #javascript

var str = "Sonic Free Games";
str = str.replace(/\s+/g, '-').toLowerCase();
console.log(str); // "sonic-free-games"
content_copyCOPY

https://stackoverflow.com/questions/1983648/replace-spaces-with-dashes-and-make-all-letters-lower-case