Javascript replacewith

broken image

3.1 The difference between replaceAll() and replace() Note that currently, the method support in browsers is limited, and you might require a polyfill. String.replaceAll(search, replaceWith) is the best way to replace all string occurrences in a string

broken image
broken image

'duck duck go'.replaceAll(' ', '-') replaces all occurrences of ' ' string with '-'.