Java String.replace vs Javascript String.prototype.replace

Java String.replace replaces all occurrences of a given string with the replacement string.