Ad
  • Custom User Avatar

    Awesome Kata! Thanks!

  • Custom User Avatar
  • Default User Avatar

    Added by someone.

  • Custom User Avatar

    the description should use language specific code blocks (or better, something language agnostic)

    note: author is inactive.

  • Custom User Avatar

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

  • Default User Avatar

    This kata caused me a lot of frustration but ultimately it was all down to a stupid error on my part. Since passing though, I've learned more JavaScript vocabulary and syntax from this kata than any JS kata I've done so far. So thank you very much for that!

  • Default User Avatar

    Okay, thanks for clearing it up.

  • Custom User Avatar

    Not a kata issue, your code is wrong, it doesn't even pass the sample tests. I've tested my code again and it passed all the tests. The error you see is because there are too many errors.

  • Default User Avatar

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

  • Custom User Avatar

    Testing functions should not be put in Preloaded. They belong in the actual tests.

  • Custom User Avatar

    Node 8+ should be enabled.

  • Custom User Avatar

    The description is really unclear. I read the description many times and still has no idea what you meant by

    estimate of the distance between the officer and a point on the road (specifically, the point at which the car will be travelling perpendicular to the estimated distance)

    Or what that point is. You really need to put up a diagram or something.

  • Custom User Avatar

    Sample test:

    // Test that negative input for distance in readings array throws error
    Test.expectError("One of the distances in readings array was negative", function() { 
      speedError(6,3,[[-50,0],[30,1]]);
      });
    // Test that a 0 input for distance in readings array throws error
    Test.expectError("One of the distances in readings array was negative", function() { 
      speedError(6,3,[[0,0],[-30,1]]);
      });
    

    The second test does not actually test what is intended to be tested because it's shadowed by the condition in the first test (there's a -30 here).

  • Custom User Avatar

    Can someone please explain this to me.

    var readings = [[50,0],[30,1];

    So the speed will be the difference in distance divided by the difference in time (figures for calculations obtained from the above array)
    converted from m/s to km/hr

    The radar gun tells you the car was 50m away from you at 0 seconds and 30m away at 1 second.
    There doesn't seem to me to be anything more that you need to know and no estimated or actual values are needed.

    So basically I don't know how to incorporate the estimated and actual values into this calculation.
    What am I not understanding about the significance of the estimated and actual values for the calculation?

    What does this mean "the point at which the car will be travelling perpendicular to the estimated distance"?

  • Custom User Avatar

    This has been added. Thanks for the feedback!

  • Loading more items...