Advertisement
Guest User

Untitled

a guest
Sep 15th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. My Comments:
  2.  
  3.  
  4. There are two functions in this code where the 1st function getToken is trying to return the argument rawString in lowercase while trying to remove any falsy items from the array. The 2nd function mostFrequentWords has a single argument: text. First it defines the two variables words and wordFrequencies. Then it used the if/else statement to setup some conditions for the two variables. The for loop is trying to repeat the instructions for a number of times. After that, the code is defining two new variables currentMaxKey and currentMaxCount. The currentMaxKey is using the object.key method to return the keys of the object as an array; and the currentMaxCount is creating an array. For the remaining of the code, it is setting conditions for the for loop using if statement to return the value for currentMaxKey.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement