Parameter: This method accepts two parameters.
- searchVal: It is the value that we want to replace in the existing string
- newVal: It is the new value that is to be put in the place of searchVal.
Return Value: This method returns a new string where the desired values have been replaced.
Example 1: In this example, we will use the replace() method to replace a character from the original string but the replace method here does not replace the characters which are in lowercase.
Example 2: In this example, the replace() method replaces the words completely irrespective of their case.
My Personal Notes arrow_drop_up
Please Login to comment...