JS reemplaza el espacio con un bajo
var string = "my name";
string = string.replace(/ /g,"_"); //returns my_name
If-dev
var string = "my name";
string = string.replace(/ /g,"_"); //returns my_name
// replaces spaces with '_'
str = str.replace(/ /g, "_");
// or
str = str.split(' ').join('_');
const name = 'Hi my name is Flavio'
name.replace(/\s/g, '') //HimynameisFlavio
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('_');