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.
but it's handy for assignment
the return statement isn't required.
I've thought the same plenty of times on this site. What you implemented was the canonical swap solution. There are plenty of other ways to swap variables. E.g. XOR swap for integers.
Argh, I should have thought of that!
Well, if there is ever an array passed to the function as the first argument, and the array has a reverse method, then it should work.
Of course you might not know about the arguments object. I don't name any arguments for the function, but there is an array-like object called arguments that appears in every function call context. It isn't technically an array (you can't use array methods without converting it to one), but you can reference it like arguments[0], arguments[1], arguments[n], arguments.length.
This comment is hidden because it contains spoiler information about the solution
you can only call reverse on an array, arguments[0] is not I get this:
arguments[0].reverse is not a function
do you mean args[0]?
And the award for the most roundabout manner of solving this kata goes to....
drumroll
Me!