Tuesday, 20 February 2018

replace a string with other string

 var somestring = "foo is an awesome foo bar foo foo"; //somestring lowercase
var replaced = somestring.replace(/foo/g, "bar").replace(/is/g, "or");
alert(replaced);

No comments:

Post a Comment