Question
Super Simple Ruby/Javascript Program. Please provide exact details of what each string means with intricate details and comments. Clarify the logic behind each line of
Super Simple Ruby/Javascript Program.
Please provide exact details of what each string means with intricate details and comments. Clarify the logic behind each line of code.
1. With a string, report the number of occurrences that a specific character appears.
No punctuations, grammar, or capitalization involved
Example : a sentence of 'aaabbc' would return { 'a': 3, 'b': 2, 'c': 1 }
another example 'you are not here' and it would count each letter.
2, With a list of words, sort them by length, and alphabetically if length is the same.
Example: ['cool', 'apple, dinosaur, fire '] would return ['apple', 'cool', 'dinosaur', 'fire']
Again, please describe in words why the program is written that specific way.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started