You need to sign in or sign up before continuing.×
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.
This comment is hidden because it contains spoiler information about the solution
i.e.,
RegExp.prototype.test
is not a pure function: it modifies itsthis
. It's documented, but I'm unsure it's a good thing ( this of course really means I think it's not ).This comment is hidden because it contains spoiler information about the solution
Nice functional style. I like it. It is very easy to see what is going on.
And as you put it "can be approached differently" :)
Since it is not possible to find some good, hard measures of what "good code" is - all submissions that run the test suite are pr. definition "good". Though, I admit, some entries are on the edge.
But even the edge solutions are of value. Some people are very good at finding the shortest route to getting through the test cases - so when writing kata test cases you are forced to be very particular which will highten your awareness of what can be bypassed.
So, in all - every submission has a value - depending on your perspective, you can learn from each (unless it's very similar to your own solution, that is :))
Thank you :) I wasn't aware of this javascript quirk. What I don't understand now is why cheating solutions gets upvotes or why people even submit them. Sure, it is interesting hack and I learned something new, but isn't the idea of this exercises to see how some problems can be approached differently (and sometimes presumably better) than you.
JavaScript allow for unicode characters in identifiers - even written as \uNNNN.
Essentially this solution is a cheat which you will see when you 'translate' the uni code characters following the assignment (first line).
Can someone please explain this solution to me? I will be very grateful.
I ran into the exact same issue but I managed to solve it. It was related to incorectly entering the [] loop.