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.
in js Boolean(" ") return TRUE and Boolean(undefined) return FALSE, if the condition throw a false condition the string will be a space string.
Actually it's in constraints that numbers will be ints, so unecessary for kata solution.
If the solution it's here means it passes the tests so either you or the kata are wrong, not the algorithm.
This comment is hidden because it contains spoiler information about the solution
So python have and don't have type coercion
Thank you for the suggestion. As this kata came out of beta more than 7 years ago, and the JavaScript version of it has been completed almost 11,000 times, it is unlikely to undergo any significant changes.
I reached the conclusion (first sort) || (second sort), but I'm not sure why. Do someone care to explain why it works this way?
Thing is you should be aware if you CAN or CAN'T change the original array. As a good practice we always copy the original to another before doing any changes, but there will always be situations where you don't need to do that.
I tryed to do this, but didn't know how to syntax it. Now I know. :D
If did that, than you should be proud of yourself. Constructing a algorithm to treat string dates ins't something trivial.
You're right. Reduce method requires a initial value, when not declared it assumes 0 but it can get nasty really quick.
This comment is hidden because it contains spoiler information about the solution
Observation: though the kata description don't ask for it, it's a good practice to copy the original array and work with it, since the sort method mutate the original array. I like to copy the original with slice method before applying any other method to the array.
Really cool, I liked the way it is compact. The only note is that the regex /\d/ won't find characters like '?', ';', '.' and so on. Luckily there aren't tests to that, but, just in case, I used /[^a-z ]/gi so it will find anything that's not a letter or a blank space.
This comment is hidden because it contains spoiler information about the solution
Loading more items...