Skip to content

Instantly share code, notes, and snippets.

@travelingtonic
Created October 25, 2018 12:03
Show Gist options
  • Save travelingtonic/fc8d51cc754dadc54cd6466ac845cbc4 to your computer and use it in GitHub Desktop.
Save travelingtonic/fc8d51cc754dadc54cd6466ac845cbc4 to your computer and use it in GitHub Desktop.
Object Challenge
Get all the text and convert to lower case then remove? any punctuation marks.
create an array to store all the words in the text
loop through the text array and if a given word is already in the text count array increment its count by 1. If a given word is not already in the text count array then add it to the array with a count of 1.
set first item in word count array as the highest max word and count
loop through each word in the word count array against the current highest and if higher count than current set highest to new current word
At end of loop return back the highest count word and its count
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment