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.
That's the thing, this kata only tests 4 digits years.
You probably have mutated the original array, which is a bad practice.
Resolved!
Please, help me!
Thank you!
Rodolfo
This comment is hidden because it contains spoiler information about the solution
I've done all tests and submited. Two tests are passed and with the third I'm getting... "Value is not what was expected" - it's not so descriptive to be honest, could you fix it?
I think that there's some kind of a strange behaviour in JS because in test cases (and in submit) variable 'data' is being overwritten by every call. It's pretty messed up.
This solutions is slightly incorrect for it's not working for every given year.
Let's say we have a year (Just an assumption) 11100.
It will return a proper age but wrong suffix.
Your algorithm is not following a rule where every number with tens digit number has to be suffixed with 'th'.
Even tho, I think it's a very clever idea and it needs just a bit of polishing.
Btw. I know that my example is quite strange but I just think that algorithm written once should be able to handle cases for years without need of being rewritten. :)
I will optimize and correct my own answer and show it to the world.