Looking for advice on the best approach to achieve my goal - any suggestions or tips are welcomed. I have made progress in identifying specific words, but now I need help logging the entire sentence containing that word to the console. Please advise.
**
<html>
<head>
<title> Program</title>
</head>
<body>
<script type="text/javascript">
var names = "hello hi welcome dills pills deaths kills thank you bye five";
names = names.split(" ");
var userInput = prompt("Enter Paragraph");
userInput = userInput.split(" ");
for (var i = 0; i < userInput.length; i++) {
for (var x = 0; x < names.length; x++) {
if (userInput[i] == names[x]) {
console.log(userInput[i])
}
}
}
</script>
</body>
</html>
**