Question: JAVASCRIPT PLZ Write a function that takes a string consisting of one or more space separated words, and returns an object that shows the number
JAVASCRIPT PLZ
Write a function that takes a string consisting of one or more space separated words, and returns an object that shows the number of words of different sizes. Words consist of any sequence of non-space characters.
EXAMPLE:
wordSizes('Four score and seven.'); // { "3": 1, "4": 1, "5": 1, "6": 1 } wordSizes('Hey diddle diddle, the cat and the fiddle!'); // { "3": 5, "6": 1, "7": 2 } wordSizes("What's up doc?"); // { "2": 1, "4": 1, "6": 1 } wordSizes(''); // {} Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
