js replace string in a string code example
Example 1: javascript replace string
var str = "JavaScript replace method test";
var res = str.replace("test", "success");
//res = Javscript replace method success
Example 2: replace all js
let a = 'a a a a aaaa aa a a';
a.replace(/aa/g, 'bb');
// => "a a a a bbbb bb a a"