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
When I attempt this kata, it will LITERALLY not let me get the basic test correct. I get the following error:
TypeError: Cannot read property '1' of undefined
...
Cases that cause the error:
return Math.floor(dist);
return Math.ceil(dist - 1);
return Number(dist.toString().match(/.*(?=.)/)[0]);
var dist = -1;
...
return Math.ceil(dist);
...
Cases that do not throw the error, but get the wrong answer:
return Math.ceil(dist); //returns 890
return dist.toString().match(/.*(?=.)/)[0]; //returns '889';
etc.
Why won't it let me get the right answer?