showing results for - "convert space to dash 2fhyphen javascript regex"
Safiya
25 Jan 2016
1var str = "Sonic Free Games";
2str = str.replace(/\s+/g, '-').toLowerCase();
3console.log(str); // "sonic-free-games"
4
Alfie
28 Jan 2017
1let str = "Sonic Free Games";
2str = str.replace(/\s+/g, '-').toLowerCase();
3console.log(str); // "sonic-free-games"
4