replace all spaces with dash in javascript

Solutions on MaxInterview for replace all spaces with dash in javascript by the best coders in the world

showing results for - "replace all spaces with dash in javascript"
Moritz
12 Jul 2020
1title = title.replace(/\s/g , "-");
2var html = "<div>" + title + "</div>";
3// ...