Ad
  • Custom User Avatar

    Can you specify which language/translation this applies to?

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    Sorry but I forgot to mark the "issue" as resolved. You can see that 373 guys passed the JS kata.

  • Default User Avatar

    Your post seems rather a question than an issue...

    Why won't it let me get the right answer?

    Maybe because something ca be wrong in your code:-)

  • Default User Avatar

    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?