Update: All recent versions of major browsers, as well as NodeJS 15+ now support replaceAll
Original:
There is no replaceAll in JavaScript: the error console was probably reporting an error.
Instead, use the /g (“match globally”) modifier with a regular expression argument to replace:
const a = "::::::";
const replaced = a.replace(/:/g,"hi");
console.log(replaced);
The is covered in MDN: String.replace (and elsewhere).