Mega Code Archive

 
Categories / JavaScript Tutorial / String
 

Using the replace() method of the String object

< html> <head> <title>Using the replace() method of the String object</title> <script type="text/javascript" language="javascript"> <!-- // var originalString = "A ab abc abcd"; var replacedString = "a"; var replacementString = "z"; var newString = originalString.replace(replacedString, replacementString); document.write("<h3>" + newString + "</h3"); // --> </script> </head> <body> </body> </html>