JavaScript String replace()
JavaScript String replace()
The replace() method is used to search a string for a value or a regular expression. It does not have any impact on the original string and will return a new string having replaced values.
Syntax:-
Its syntax is:- string.replace(searchValue, newValue)
Return:-
Its return is:- new string where the specified value has been replaced.
Further Explanation:-
Parameter | Description |
searchValue | Required. The value, or regular expression, to search for. |
newValue | Required. The new value. |