convert 2freplace space to dash 2fhyphen javascript

Solutions on MaxInterview for convert 2freplace space to dash 2fhyphen javascript by the best coders in the world

showing results for - "convert 2freplace space to dash 2fhyphen javascript"
Tom
03 Jan 2020
1const str = "Sonic Free Games";
2str = str.replace(/\s+/g, '-').toLowerCase();
3console.log(str); // "sonic-free-games"
4
Gael
17 Mar 2019
1var str = "Sonic Free Games";
2str = str.replace(/\s+/g, '-').toLowerCase();
3console.log(str); // "sonic-free-games"
4