Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save AppMkrATL/5270e8a9aa7f9010507fbb7463bb6c76 to your computer and use it in GitHub Desktop.
Save AppMkrATL/5270e8a9aa7f9010507fbb7463bb6c76 to your computer and use it in GitHub Desktop.
link to commented code: https://repl.it/@SamKhaled/most-frequent-word-analyzer-challenge-1
Requirements:
============
In this challenge, you'll practice grokking (that is, understanding) code written by someone other than yourself.
Working as a developer, much of your time will be spent working on existing code, and being able to read code
written by someone else and quickly figure out what it's doing is a core skill to develop.
For this challenge, we provide a function called mostFrequentWord.
This function takes a single argument, text, which is a body of text
(for instance, a paragraph from a novel, or song lyrics) and returns the word that occurs most frequently in that text.
To complete this challenge, closely and slowly read through mostFrequentWord.
Focus on understanding how each line works and its role in advancing the overall algorithm.
Some of what you'll see will be familiar (for loops and getting and setting properties on objects).
You'll also encounter new things (for instance, using regular expressions in the getTokens function).
When you encounter something new like regular expressions, don't worry about mastering them, but instead
focus on understanding their role in the algorithm.
You should type up notes explaining how this algorithm works. The format is up to you.
You can add comments to each line of code or write up a paragraph or two. Save your notes in a Gist, and submit a link to it below.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment