how to replace / in javascript code example
Example 1: js replace characters in a string
var str = "Original string!";
var str = str.replace("Original", "New");
Example 2: replace in string javascript
const p = 'hello world ! hello everyone ! ';
const regex = /hello/gi;
console.log(p.replace(regex, 'good morning'));
console.log(p.replace('hello', 'good evening'));
Example 3: replace javascript
let newText = startText.replace("yes", "no")
console.log(newText)
newText = startText.replace(/yes/g, "no")
console.log(newText)
newText = startText.replace(/yes/gi, "no")
console.log(newText)