This JavaScript function takes a string of text and returns an array of the top 3 most occurring words, in descending order of occurrences.
To use this function:
- Clone the repository to your local machine using
git clone https
- go to directory
cd
-
make sure you install npm and node js on your system link
-
uncomment the function call in
index.js
and run the project by
npm start
or in watch mode
npm run watch
const topWords = top3Words("Your text goes here...");
console.log(topWords); // Output
To run tests, use the following command:
- to install jest
npm install
- to run test
npm test