JavaScript में स्ट्रिंग के घटनाओं को बदलने के लिए, replace() विधि का उपयोग करें:
<html>
<body>
<script>
var str1 = 'John loves studying. He loves Football too!';
var str2 = str1.replace(/loves/g, "likes");
document.write(str2);
</script>
</body>
</html>