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.
There is currently no test case that checks the semantics stated in the description.
The function must not call the iterator function after the match is found.
The following test will break even the most popular solution (ha-ha).
Some incorrect solutions use
String#trim
to get rid of whitespace.Please add the following simple test:
\s
catches newline characters, no need for\n
in your first RE.The trick is so clever!
This is because toFixed() returns a string but number is expected.
+n.toFixed(3)
works perfectly.assertSimilar
can't distinguish-Infinity
,+Infinity
, and"null"
from actualnull
, and therefore some incorrect solutions pass. I would either state the requirements explicitly or useassertEquals
instead.Also I think it would make sense to expect
Infinity
in case of a vertical line andnull
in case of equal points.I can add that it is not stated in the description at all that an empty tag name indicates a text node. Killed some time and finally cheated to discover this requirement.
FYI,
Math.pow(10, -7)
can be written in literal form as1e-7
.This is not what katas are designed for.
This comment is hidden because it contains spoiler information about the solution
Yes, if there is any other identifier named "func", it hides the function from the outer environment.
Fails (with TypeError) on this one:
The hardest part of this kind of solutions is generating unique identifiers.
You do not need to decrement 'i' inside the inner function.
Actually it is a single-RegExp problem (or maybe 2 or 3).