js replace space with minus code example
Example: javascript replace space with minus
// replaces space with '-'
str = str.replace(/ /g, "-");
// or
str = str.split(' ').join('-');
// replaces space with '-'
str = str.replace(/ /g, "-");
// or
str = str.split(' ').join('-');