Ad
  • Custom User Avatar

    Excellent, I'll read up on that link. Thank you for your reply.

  • Custom User Avatar

    The chief advantage is that all the objects will share the same method instead of a new one being created for each instance.
    You can find a more detailed difference here: Declaring javascript object method in constructor function vs. in prototype

  • Custom User Avatar

    I'm curious about the difference between adding the method to the constructor versus using the prototype method as shown in this answer. What's the advantage? Many users have voted this solution a best practice so I imagine the difference is significant. Thanks.

  • Custom User Avatar

    Needs fixed tests for card number length.
    Currently these are only randomly triggered by the random tests.
    And the test failure message needs to be helpful in this case.

    (Ruby version, but I expect the other languages are similar.)

  • Custom User Avatar

    Ok thank you, I appreciate your quick reply. I'll continue to write tests and try to figure out why I'm getting a false match.

  • Custom User Avatar

    No you're not. Unfindables are just those numbers that exist outside of valid card numbers - so your solution is matching numbers as Mastercard even though they're outside the expected range/rules for a Mastercard. I might change that message to make it clearer I think.

  • Custom User Avatar

    I'm unclear on what "unfindables" are. I've written about 20 or so tests that pass and when I submit my solution everything passes except the second of the two "It should return Unknown for unfindables". The submission test result stated "Expected: Unknown, instead got: Mastercard". I wrote a new batch of tests to try and nail down variations of the Mastercard rules that shouldn't pass but cannot replicate this failure. Am I missing something in the definition of "unfindables"?