This is my code it replaces only one word at a time. I want it to replace all the words at once.
<!DOCTYPE html>
<html>
<body>
<p>Replace "Microsoft" with "google" in the paragraph below:</p>
<button onclick="myFunction()">Try it</button>
<p id="demo">Please visit Microsoft Microsoft Microsoft Microsoft!</p>
<script>
function myFunction() {
var str = document.getElementById("demo").innerHTML;
var txt = str.replace("Microsoft","google");
document.getElementById("demo").innerHTML = txt;
}
</script>
</body>`enter code here`
</html>