Javascript Replace Space By Underscore

[Solved] Javascript Replace Space By Underscore | Php - Code Explorer | yomemimo.com
Question : js replace space with underscore

Answered by : kees-van-beilen

var string = "my name";
string = string.replace(/ /g,"_"); //returns my_name

Source : | Last Update : Fri, 01 May 20

Question : javascript replace space by underscore

Answered by : vastemonde

// replaces space with '_'
str = str.replace(/ /g, "_");
// or
str = str.split(' ').join('_');

Source : | Last Update : Tue, 18 May 21

Question : replace underscore with space in js

Answered by : shehroze-ali

str.replace(/_/g, ' ');

Source : https://stackoverflow.com/questions/11810569/how-to-replace-underscores-with-spaces | Last Update : Fri, 30 Dec 22

Question : replace underscore with space

Answered by : you

string_with_underscore = "hello_world"
string_with_space = string_with_underscore.replace("_", " ")
print(string_with_space)

Source : | Last Update : Tue, 19 Sep 23

Answers related to javascript replace space by underscore

Code Explorer Popular Question For Php