replace()
Replaces a substring with another string.
Syntax
text.replace(old, new)
Description
Replaces all old parts in the text with new ones. Doesn't break the original, returns new text.
Parameters
| old | The piece being searched for. |
| new | The piece to put in its place. |
Returns
Modified new text.
Example
Loading editor…
Expected output
emma max emma
When to use?
Cleaning up text, filling placeholders in templates.