Are you first timer at lazacode.org? Why not join us and start exchange your programming knowledge with everyone. Register today!

JS - replace character

0 votes
50 views
added May 31, 2018 in Javascript by azhaer Corporal (1,070 points)
edited Jul 13, 2018 by LC Marshal
//Replaces all spaces with '-'!
city_name=city_name.replace(/ /gi,'-');

2 Responses

0 votes
responded May 31, 2018 by azhaer Corporal (1,070 points)
edited Jul 13, 2018 by LC Marshal
var text = "I love you no matter what";
var new_text = text.replace("love", "hate");
document.write(new_text);
0 votes
responded Aug 6, 2019 by lccontrib Private (270 points)
var str="Test:";
document.write(str.replace(/:/g, ""));

 

lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.
...