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 found the solution, for my case, my counter was initialized outside of the function and I return the value of it when the condition in the question has been met.
So when the tests runs the function the value of the counter stays the same after you called it for the first time, the test doesn't reset your counter. That's the reason why my kind of recursion doesn't work.
I'm using javascript, recursion function still doesn't work. It's frustrating.