Currently, I am working on developing a feature that will filter out negative responses in a magic 8-ball application. The goal is to exclude any elements from the response array that contain the word "no" while preserving responses that contain words like "now" or "not".
const responses = [
"It is certain",
"It is decidedly so",
"Without a doubt",
"Yes, definitely",
"You may rely on it",
"As I see it, yes",
"Most likely",
"Outlook good",
"Yes",
"Signs point to yes",
"Reply hazy try again",
"Ask again later",
"Better not tell you now",
"Can't predict now",
"Concentrate and ask again",
"Don't count on it",
"My reply is no",
"My sources say no",
"Outlook not so good",
"Very doubtful"
]
const negativeResponseDeleter = () => {
let splitTracker = 0
let holdingArray = []
for (i = 0; i < responses.length; i++) {
holdingArray = responses[i].split(" ")
if (holdingArray.includes("no")) {
}
}
}
console.log(negativeResponseDeleter())
The code snippet above represents my current progress on this task, but I am facing some challenges. I am exploring the most effective approach to tackle this issue.