Grammar Checker

Hello, Can anyone help me on following code. I am facing an error of “is not function”.

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 breathtaking 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';
//console.log(storyWords);
//console.log(storyWords.join(' '));

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

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

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

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

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

let badWordIndex = storyWords.findIndex(word => {
return word === badWord;
}); 

storyWords = storyWords.findIndex(word => {
storyWords[78] = 'really';

});
console.log (badWordIndex);

let lengthCheck = storyWords.every(word => {
  return storyWords.length < 10;
});


You change stroryWords from being an array to being a number
when you did storyWords = storyWords.findIndex()

Also, you should be checking when that word is ‘really’,
so that code should be

storyWords = storyWords.findIndex(word => {
  return word === 'really';
});

storyWords[78] = 'really'; // outside the .findindex

Also, for lengthCheck at the end,
you should be checking whether the length of word (string) is less than 10, instead of checking whether the length of storyWords (array) is less than 10.

Thank you so much for your help. I have followed your guidelines and it’s working fine now.

thank you for this useful content. :muscle: