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.
wow... why always u?
This relies on the type coercion. If you have use '===' it doesn't work unless you explicitly convert the result of add to a Number.
It's unfortunate that the test cases use '==' instead of '==='.
This is soooo gross! I guess I can probably understand it better than some of these other solutions though, so there is that.
I agree. It's so weird that this is tagged with "Functional Programming" and we're modifying the reference. It also makes the solution needlessly complex and has potentially surprising behavior.
This comment is hidden because it contains spoiler information about the solution
I was in an even worse position. I didn't even know valueOf was a thing.
This solution might be robust, but its robust at the expense of readability. It also doesn't use any functional concepts which is what this kata is all about.
I disagree on the clean/perfect part. It's harder than necessary to read this because the formatting is terrible. Proper indentation would make this much more enjoyable to look at.
However, after prettifying it and working through it I think it's a really elegant solution. Especially compared to a lot of the solutions below it.
I love how you used reduce here. This is just a much cleaner way of doing what I did with two for-loops.
This comment is hidden because it contains spoiler information about the solution