Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
When you mutate the input, unexpected results could happen. I've changed the tests so it doesn't matter anymore, but keep that in mind.
That happened because you mutated the input in your code. Now it doesn't matter.
because count is an object. the ternary operation is checkin if the property (key: value) is in the count object already. if yes, it adds 1 to the stored value, if not it sets/adds the property.
so if string = 'example', the first run is going to see that count is empty, so count['e'] doesn't exist, and it will set count[e] = 1. then you have count = {e: 1}.