JavaScript Substitua todo o espaço
// replaces spaces with '_'
str = str.replace(/ /g, "_");
// or
str = str.split(' ').join('_');
VasteMonde
// replaces spaces with '_'
str = str.replace(/ /g, "_");
// or
str = str.split(' ').join('_');
var replaced = str.replace(/ /g, '_');
var string = "Javascript is fun";
var newString = string.replace(" ", "_");
console.log(newString); // Javascript_is_fun
var str = 'a b c';
var replaced = str.split(' ').join('_');
String = String.replace(/ /g, "_");
String = String.split(' ').join('_');