Grammar Checker Project - Question about the additional improvements for "Removing the word “very”."

Hi! I’m working on the Grammer Checker project and I’m stuck on one of the practices after you complete the project. It’s the first time I’m completely on my own and I can’t quite get it.

Here’s a link to the project since this is asking me to add it: https://www.codecademy.com/courses/introduction-to-javascript/projects/mini-linter

This is the code that I have so far for removing the word “very”:

//REMOVE THE WORD VERY
let remove = 'very';

//get index of very's and then remove them with splice!

let veryIndex = storyWords.findIndex((word) => {
  return word === remove;
});
console.log(veryIndex + ' is very index');

storyWords.splice (storyWords.indexOf(veryIndex), 2)

Any thoughts on how it could be done?

Thanks so much!
Kevin

Ok I’ve made progress!

I can’t use splice because it can only remove 1 or multiple items in a row. So I got close with filter! I have a new array with very removed, but now I need to able to call the original array, and have them removed. “console.log(storyWords.join(’ '));”. Or maybe that doesn’t matter at this point since I have the new array that I can use that has the words removed?

const removeVery = storyWords.filter((word) => word !== 'very');

console.log(removeVery.join(' '));

Thanks! :smiley:
Kev

Same here!

I am trying to change the word ‘very’ using map() method but it doesn’t work…

let story = 'Last weekend, I took literally the most beautifull bike ride of my life. The route is called "The 9W to Nyack" and it stretches all the way from Riverside Park in Manhattan to South Nyack, New Jersey. It\'s really an adventure from beginning to end! It is a 48 mile loop and it literally took me an entire day. I stopped at Riverbank State Park to take some artsy photos. It was a short stop, though, because I had a freaking long way to go. After a quick photo op at the very popular Little Red Lighthouse I began my trek across the George Washington Bridge into New Jersey. The GW is a glorious 4,760 feet long! I was already very tired by the time I got to the other side. An hour later, I reached Greenbrook Nature Sanctuary, an extremely beautifull park along the coast of the Hudson. Something that was very surprising to me was that near the end of the route you literally cross back into New York! At this point, you are very close to the end.';

let storyWords = story.split(' ');
let unnecessaryWord = 'literally';
let misspelledWord = 'beautifull';
let badWord = 'freaking';

let count = 0
storyWords.forEach(word => count++)
console.log(count)

storyWords = storyWords.filter((word) => {return word !== unnecessaryWord})

storyWords = storyWords.map((word) => {
  return word === misspelledWord ? 'beautiful' : word
});

let badWordIndex = storyWords.findIndex((word) => {
  return word === badWord
})
console.log(badWordIndex)
storyWords[78] = 'really'

let lengthCheck = storyWords.every((word) => {
  word.length < 10;
})
console.log(lengthCheck)
let changeWord = storyWords.findIndex((word) => {
  word.length > 10 && console.log(word);
})
let changeVery = storyWords.map((word) => {
 return word === 'very' ? ' ' : word && console.log(word)
})

console.log(storyWords.join(' '))
//console.log(storyWords)

I have also tried to add ‘very’ to the array of unnecessaryWords but this also doesn’t work. I am stuck