Java/.Net/etc. will search for all occurrences of the target string and replace it with the replace string.
So, here’s the quick and easy way to change your single replacement to an all replacement. Note that the ‘g’ in the regexp below is important as it specifies the expression to search globally.
str.replace(new RegExp('targetedString', 'g'), 'replaceWith');