overusedWords remove it every other time it appears

let story = 'Last weekend, I took literally the most beautiful bike ride of my life. The route is called "The 9W to Nyack" and it actually 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 basically took me an entire day. I stopped at Riverbank State Park to take some extremely artsy photos. It was a short stop, though, because I had a really long way left 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 actually very long - 4,760 feet! I was already very tired by the time I got to the other side.  An hour later, I reached Greenbrook Nature Sanctuary, an extremely beautiful park along the coast of the Hudson.  Something that was very surprising to me was that near the end of the route you actually cross back into New York! At this point, you are very close to the end.';

let overusedWords = ['really', 'very', 'basically'];

let unnecessaryWords = ['extremely', 'literally', 'actually'];

const storyWords= story.split(' ')
// console.log(storyWords.length)
const betterWords= storyWords.filter(better => !unnecessaryWords.includes(better))
// delete every overused words
let oUOnce= betterWords.filter(once => !overusedWords.includes(once))
// trying to add into betterWords[37] "really" and then 'very' and 'basically'
// let notworking should be // betterWords[37].push('really') 
let notworking=betterWords[betterWords.indexOf(overusedWords[0])].push(overusedWords[0]) 

Hi guys
I’m trying to keep only 1 really/very/basically on betterWords.
i tried to find the index of overusedWords[0] “really” inside betterWords (should be index 37) to .push “really” into that index and then should return // etc… It’s really an adventure from etc…
After using oUOnce to remove every overusedWords, i’m trying to reinsert it only once. But it doesn’t seems to work. variable not working is just a test and translated should be betterWords[37].push(‘really’)

Learn JavaScript | Codecademy
N.8

  1. For the overused words, remove it every other time it appears.

SOLVED

let story = 'Last weekend, I took literally the most beautiful bike ride of my life. The route is called "The 9W to Nyack" and it actually 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 basically took me an entire day. I stopped at Riverbank State Park to take some extremely artsy photos. It was a short stop, though, because I had a really long way left 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 actually very long - 4,760 feet! I was already very tired by the time I got to the other side.  An hour later, I reached Greenbrook Nature Sanctuary, an extremely beautiful park along the coast of the Hudson.  Something that was very surprising to me was that near the end of the route you actually cross back into New York! At this point, you are very close to the end.';

let overusedWords = ['really', 'very', 'basically'];

let unnecessaryWords = ['extremely', 'literally', 'actually'];

const storyWords= story.split(' ')
// console.log(storyWords.length)
const betterWords= storyWords.filter(better => !unnecessaryWords.includes(better)) 
let oUOnce= betterWords.filter(once => !overusedWords.includes(once))
oUOnce.splice(betterWords.indexOf(overusedWords[0]), 0 ,overusedWords[0]);
oUOnce.splice(betterWords.indexOf(overusedWords[1]), 0 ,overusedWords[1]);
oUOnce.splice(betterWords.indexOf(overusedWords[2]), 0 ,overusedWords[2]);
console.log(oUOnce.join(' '))
console.log(betterWords.indexOf(overusedWords[0]))

Is there a better way insead of repeat .splice for 3 times?

Hey there!
One way you could remove the overusedWords could be to iterate through your storyWords array you created with the .split(' ') method and push the words into a new array after checking if any of elements do not equal any elements from overusedWords.

const newStoryArray = []
for (let i = 0; i < storyWords.length; i++) {
    if ((storyWords[i] != overusedWords[0]) || (storyWords[i] != overusedWords[1]) || (storyWords[i] != overusedWords[2])) {
        newStoryArray.push(storyWords[i]);
    };
};
console.log(newStoryArray.join(' '));