# Tag: replace

## javascript – How to replace all occurrences of a string?

The Question : 4633 people think this question is useful I have this string: Doing: seems to only remove the first occurrence of abc in the string above. How can I replace all occurrences of it? The Question Comments : When replacing all occurrences of aba in ababa with ca, which result do you expect?

## javascript – How to replace all occurrences of a string?

The Question : 4626 people think this question is useful I have this string: "Test abc test test abc test test test abc test test abc" Doing: str = str.replace('abc', ''); seems to only remove the first occurrence of abc in the string above. How can I replace all occurrences of it? The Question Comments