Skip to main content

replace

Replace each instance of the substring with the specified string.

"This is some example text... and this is some more".replace("is", "was"); 
// "Thwas was some example text... and thwas was some more"

Syntax

replace(source, target)

Returns

A new string containing the replaced substrings.