JavaScript replace() function replace the string provided with new value. See the code snippet:
replace()