Given a string of letters, I'm looking to create an object containing key value pairs with the letter as the key and the number of occurrences within the string as the value.
So given "aabccc", the function should return: { a: 2, b: 1, c: 3 }
What would be a good way to count the letters? Ideally adhering to functional programming paradigm and utilizing ES6 functionality if it's applicable. Until now I've only worked with C++ and OO so I'm working through exercises using tools and techniques outside of my comfort zone. I'm very new to all the new features of ES6 and functional programming so I'm hoping to develop the correct mindset for them.
Any insights would be greatly appreciated. Thank you.