In: Computer Science
****This requires some effort so please drop a like if you are satisfied with the solution****
index.html:
<html>
<head>
<script src="index.js"></script>
</head>
<body>
<button onclick="replace()">Click me</button>
</body>
</html>
index.js
var str="I am a good person He is very bad my name is Mark and his name is Albert he is doing great but feeling bad very rarely 100% fully"
words=[]
document.write(str);
function replace(){
words.push(window.prompt("Enter a adjective"))
words.push(window.prompt("Enter a adjective"))
words.push(window.prompt("Enter a verb"))
words.push(window.prompt("Enter a verb"))
words.push(window.prompt("Enter a adverb"))
words.push(window.prompt("Enter a adverb"))
words.push(window.prompt("Enter a name"))
words.push(window.prompt("Enter a name"))
words.push(window.prompt("Enter a number"))
story=str.split(" ");
for(i=0;i<story.length;i++){
if(story[i]=="good")
story[i]=words[0];
if(story[i]=="bad")
story[i]=words[1]
if(story[i]=="doing")
story[i]=words[2]
if(story[i]=="feeling")
story[i]=words[3]
if(story[i]=="rarely")
story[i]=words[4]
if(story[i]=="fully")
story[i]=words[5]
if(story[i]=="Mark")
story[i]=words[6]
if(story[i]=="Albert")
story[i]=words[7]
if(story[i]=="100%")
story[i]=words[8]
}
story=story.join(" ");
console.log(story);
var newStory=story;
str=""
document.write(newStory);
}