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.
I had the same issue with my JS solution. I was missing a step.
The instructions cover this case, where the string length is already less than or equal to 3 characters:
e.g. trim("He", 1) should return "H..."
But not this case, where the act of trimming reduces the string length to less than/equal to 3 characters:
e.g. trim("Elephant", 2) should return "El..."
That part was not clear to me until the final test cases (the basic tests also didn't cover the case).
I think the following statement could be clarified to indicate that the string length referred to is not just that of the original input, but also of the trimmed fragment:
"If the string is smaller than or equal to 3 characters then the length of the dots is not added to the string length."