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.
you are always going to want to retain the first value in the iterable, so it does not matter that that comparison will always evaluate to true.
I tried it and it failed in two of the test cases (I think where one array was empty and the other was null)
I stand corrected! The !! handles two edge cases where not having it failed. I'll be using this technique thank you.
Actually pretty readable. I'd say this is the clear winner. Even though I think you don't need to do it (a && b &&...) should work fine, I had yet to see that way of converting to a boolean and appreciate it. I can't think of an application right now beyond using the truthyness/falsiness of the original array but maybe there is one?
Why isn't there a method to reverse a string directly? seems like an oversight.
This is probably best practices as well because it won't have a problem with null or undefined as toString() will.
This comment is hidden because it contains spoiler information about the solution
beautiful use of the short circuit. I vote this for best practice as it's very readable too.
very elegant!
Very happy that I had something close to this. Reduce is not very intuitive at first. I had to mess around to get it to work.