Hi y’all!
I have some questions
So, this is what I did to find out the counts for overusedWords:
const overuseReally = storyWords.filter(word => word === overusedWords[0]).length;
const overuseVery = storyWords.filter(word => word === overusedWords[1]).length;
const overuseBasically = storyWords.filter(word => word === overusedWords[2]).length;
console.log(`Count 'really': ${overuseReally}, Count 'very': ${overuseVery}, Count 'basically': ${overuseBasically}`);
And I wanted to use the same method for getting number of sentences, but I realized that “.” should be a single string for me to be able to do so. So I used this method instead:
let countSentences = 0;
for (word of storyWords) {
if (word[word.length - 1] === "." || word[word.length - 1] === "!") {
countSentences += 1;
}
};
console.log(`Count sentences: ${countSentences}`);
-
I’m really curious, how do you separate words from “.” / “!” ?
Ex) from “life.” to “life”, “.” -
Also, I’d love to solve Task no. 8 :
- For the overused words, remove it every other time it appears.
- Write a function that finds the word that appears the greatest number of times.
- Replaced overused words with something else.
If anyone was able to do those please let me know!