Replacing Characters of a String

Learn how to replace characters in a string using the replace method.

The replace method

The replace string method returns a new string, where the first substring specified by its first argument is replaced with its second argument:

Get hands-on with 1200+ tech skills courses.