how to replace all spaces with dashes in a string javascript code example
Example 1: javascript replace spaces with dashes
title = title.replace(/\s/g , "-");
Example 2: replace all spaces with dash in javascript
title = title.replace(/\s/g , "-");
var html = "<div>" + title + "</div>";
// ...