My Mini Linter project

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(' ');


const betterWords = storyWords.filter(word => {
  return word !== 'extremely' && word!== 'literally' && word !== 'actually';
});

// console.log(betterWords);


// count really

const reallyCount =() => {

  let count = 0;

for (let i = 0; i< betterWords.length; i++) {

  if ( betterWords[i] === 'really') {
    count += 1;
  }

}
  return `really: ${count}`;
}

// console.log(reallyCount());


// count very

const veryCount =() => {

  let count = 0;

for (let i = 0; i< betterWords.length; i++) {

  if ( betterWords[i] === 'very') {
    count += 1;
  }

}
  return `very: ${count}`;
}

// console.log(veryCount());

//basically count

const basicallyCount =() => {

  let count = 0;

for (let i = 0; i< betterWords.length; i++) {

  if ( betterWords[i] === 'basically') {
    count += 1;
  }

}
  return `basically: ${count}`;
}

// console.log(basicallyCount());


// sentence count
const dotFinder = () => {
let count = 0;
for ( let i= 0; i< story.length; i++) {
  if ( story[i] === '.') {
    count += 1;
  }
}
return count;
}

// console.log(dotFinder());

const excalmationFinder = () => {
 let count = 0;
for ( let i= 0; i< story.length; i++) {
  if ( story[i] === '!') {
    count += 1;
  }
}
return count;
}

// console.log(excalmationFinder());

const totalSentence = dotFinder() + excalmationFinder();

// console.log(totalSentence);


console.log(`The word count : ${storyWords.length}`);
console.log(`The sentence count : ${totalSentence}`)
console.log(`${reallyCount()} times used`);
console.log(`${veryCount()} times used`);
console.log(`${basicallyCount()} times used`);
console.log(betterWords.join(' '))

I have tried my best to done it without tutorial help… My code is working but In tutorials instructor done that differently.

Hello @romelmahmud, welcome to the forums! Even though the CC instructor may have done it differently, your code looks good, and it looks like it should work well. It also seems that you’ve followed good naming conventions; well done!

1 Like

@codeneutrino thanks a lot … its means lot to me…

1 Like