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.
Note: If the input string contains no digits, this solution will return a 0, which might be unexpected behavior. By contrast,
parseInt()
and unary+
coercion will result inNaN
.5 - 1,99 = 3,01 and since 3,01 > 3 you are not inside the margin.
One more idiotic solution for this kata
When I klick the "RUN SAMPLE TESTS" botton, everithing is ok, but when the "ATTEMPT":
"Passed: 3 Failed: 100 Errors: 1"
With such errors:
Log
Testing for: one,of,break,better,those,hard
Expected: NaN, instead got: 6
JavaScript
@Roncev I just tested out the JavaScript version and the test cases are working correctly. Can you confirm which version of the kata you're running and that you don't have the error message reversed?
In JS Attempt tests "Expected: NaN" everywhere.
Kata without possible solution.
Accordingly to test cases 2,5,3 should return 0, but 1.99,5,3 sould return -1, despite the fact that 1.99 < 3. I don't get it.