JavaScript replaceAll()
ES2021 has introduced the replaceAll() method for string manipulation in javascript.
const newString = oldString.replaceAll(pattern,replacement)
As you may have guessed by its name it replaces all the occurrences of the pattern with the…