How do I replace all occurrences of a string in JavaScript?

Опубликовано: 01 Октябрь 2024
на канале: Code Samples
84
2

Given a string:
s = "Test abc test test abc test test test abc test test abc";

This seems to only remove the first occurrence of abc in the string above:
s = s.replace('abc', '');

How do I replace all occurrences of it?
replaceAll: https://developer.mozilla.org/en-US/d...
Can I use: https://caniuse.com/?search=replaceAll
https://jsben.ch/TZYzj: https://jsben.ch/TZYzj