Ad
  • Default User Avatar

    I was failing at the same test. Try to figure out how your function behave when you pass boolean values as input

  • Default User Avatar

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

  • Default User Avatar

    I thought about this but thought there might be some longer years thrown in exactly because of this. Then again, "YYYY" does imply only four-digit years would be used...

  • Custom User Avatar

    Well, to answer your original question, that seems a good idea (though it may depend on the language you use, which makes it more or less difficult), and that's how I personnally solved this kata in several languages (but in others I did it only parsing the array, and not destructuring it, which is a better and more instructive practice, IMO). Now, it's easy to get lost and/or do something bad so that it eventually doesn't work. Hard to help you without knowing more. You should consider carefully the tests that fail, print stuff to check the progress of your output... In one word: debug it.

  • Default User Avatar

    My bad, thanks.

  • Custom User Avatar

    Read this: https://docs.codewars.com/training/troubleshooting/

    You're using a couple global vars there. Try calling your code in those compilers more than once.

  • Custom User Avatar

    Use spoiler flag next time.

  • Default User Avatar

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