In case we want to
Replace a particular character or characters from the sting we can follow this approach.
<script> var v = "my text"; document.write(v.replace("my", "our")); </script>
In the above code snippet we stored “my text” string into the
v variable. In the next line we have called the
replace method by passing the characters to replace and characters to replace with. As a result when the above code renders on the webpage, it shows “our text”.
Views: 2313 | Post Order: 52