Hello all
So I got stuck in the option 4 of this skill path where we have to find the how many times the words have been overused in the story. So made the function and did that with the help of for loop. But the problem is that I didn’t get the results which I expected . So please help me out.
const betterWords = storyWords.filter(words => !unnecessaryWords.includes(words));
console.log(betterWords.length);
let [counter1,counter2,counter3] = [0,0,0];
const usedWords = ()=>{
for(let i = 0; i <= betterWords.length; i++){
if(betterWords.includes("really")) {
counter1 += 1;
}else if(betterWords.includes("very")){
counter2 += 1;
}else if(betterWords.includes("basically")){
counter3 += 1;
}
}
console.log(`The word really is used ${counter1} times.`);
console.log(`The word very is used ${counter2} times.`);
console.log(`The word basically is used ${counter3} times.`);
}
usedWords();
Output I’m getting
The word really is used 183 times.
The word very is used 0 times.
The word basically is used 0 times.