Search and replace the the string in Javascript

replace(search str, replace_str):  Replaces the very first occuance oif the search string.

string = 'Praise the Lord';
string = replace('Praise', 'Jesus is');
alert(string);

This returns: "Jesus is the Lord"



No comments:

Post a Comment