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're 100% correct. Don't know where I got the notion that A-z would match only letters. Thanks for the feedback! Should be
A-Za-z
instead.odaba, under the definition of this kata,
var
is a valid identifier (your solution seems to allows it too, so I don't know if you're criticizing or just pointing it out). Javascript, and most programming languages, have a blacklist of "reserved words" (e.g.var
et al. in Javascript). Then there's the whole set of valid identifiers in Javascript, which has extensive Unicode support for identifiers, that this Kata doesn't come close to covering.OverZealous, in my tests, my solution is more efficient than the one you offered as an example of what would be more efficient, but it actually flips back and forth quite often. It really depends on the compiler because they're equivalent functionally (i.e. /[ab]/ == /a|b/). When I run the following in the Firefox console,
b
(the version I offered) has slightly better performance thana
(the counterversion you're arguing has slightly better performance):Also, using
|
instead of a character class ([$\w]
) is going to have (slightly) poorer performance, since it will have to track location and backtrack on misses (and early exits are slower).@odaba: Nope. At some point, your list runs out of elements.