replace() / replaceAll()
Replaces a part with something else.
Syntax
text.replace(old, new)
Description
replace changes the first match, replaceAll changes all matches. Returns new text.
Example
Loading editor…
Expected output
emma leo emma emma
When to use?
Text cleaning, filling templates.