let string = ":insertx: :insertx: :inserty: :inserty: :insertz: :insertz:"; let newstring = string.replaceAll(":insertx:", 'hello!');
When I run this, I receive
Uncaught TypeError: string.replaceAll is not a function. Maybe I’m misunderstanding what a prototype is, but the function appears to be a string method that is available for use.
I’m using Chrome.
.replaceAll will be available starting on Chrome 85. The current version is 83.
If you download Google Chrome Canary (which is on version 86), you’ll be able to see that your code runs fine. Firefox is on version 78, and since
.replaceAll has been available starting version 77, it works there too. It will work on current Safari as well. Microsoft Edge has it as unsupported.
You’ll find supported browser versions at the bottom of the article in your question.