Wednesday, 1 April 2015

What is the use of replace() function in Javascript ?.



The replace() method replaces a specified value with another value in a string.


str = "Please visit Microsoft!"; 
var n = str.replace("Microsoft","W3Schools");
The replace() method can also take a regular expression as the search value. 

No comments:

Post a Comment