Using the replace() method of the String object : replace : String JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » String » replace »

 

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>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo String
» replace