Question: 6 . 2 7 Coding Assignment for Module 1 0 Write the function calcWordFrequencies ( ) that has a single words parameter. calcWordFrequencies ( )

6.27 Coding Assignment for Module 10
Write the function calcWordFrequencies() that has a single words parameter. calcWordFrequencies() is called with a string argument containing a list of words separated by spaces. The function should output those words and their frequencies to the console.
Ex: If the function call is:
calcWordFrequencies("hey hi Mark hi mark");
then the console output is:
hey 1
hi 2
Mark 1
mark 1
Hint: First use the string method split() that splits a string into an array using a delimiter. Ex: words.split("") returns an array containing each word in words. Then place unique words in a map, where the key is the word and the associated value is the word's frequency.
6 . 2 7 Coding Assignment for Module 1 0 Write

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!