Returns a new string with all matches replaced.
Syntax
str.replaceAll(searchFor, replaceWith)Example
Enter values below to update the example in real time.
const→console→replaceAll→const text = "Hello World World";
console.log(text.replaceAll("World", "JavaScript"));
// "Hello JavaScript JavaScript"