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.
Because the mind of a genius is capable of handling an unlimited amount of complexity, even it is totally uneccessary and wrong :P
WTF??? HOW the heck did you even able to write this? let alone testing and debugging it :O
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This is a do / while loop simulated via recursion. A non-recursion equivalent might look like this:
Can anyone please help me understand the return statement, a ternary operator in this case, which in the else clause basically calls the function dirReduc(arr). How does this work, why don't we get "RangeError: Maximum call stack size exceeded."? I tested by removing the ternary operator and just returning the arr, and it worked, which makes more sense to me. If it work, why did the authors of solutions of this kata use the ternary operator instead of just returning the arr?