Is there a way to iterate through an array of strings and convert them into an array of objects based on their values?
For instance, if the array looks like this:
[a,a,a,b,b,c,d]
I aim to cycle through the array and create objects with key-value pairs that increment the values for each string:
[{a:1},{a:2},{a:3},{b:1},{b:2},{c:1},{d:1}]
Any suggestions on how to accomplish this task?
I've attempted mapping through the array, but I'm struggling with updating the value of the previous object (a:1 -> a:2).