nodejs replace character in string code example
Example 1: javascript replace
var res = str.replace("find", "replace");
Example 2: js replace characters in a string
var str = "Original string!";
var str = str.replace("Original", "New");
Example 3: javascript regex replace
const search = 'duck'
const replaceWith = 'goose';
const result = 'duck duck go'.replaceAll(search, replaceWith);
result; // => 'goose goose go'
Example 4: str replace javascript all
str.replace(/abc/g, '');