replace string with space in javascript code example
Example 1: js replace space
// replaces space with '_'
str = str.replace(/ /g, "_");
// or
str = str.split(' ').join('_');
Example 2: javascript string spaces replace with %20
string.replace()