Ad
  • Custom User Avatar

    Just a suggestion on terminology here: 'The depth() method should return the maximum number of nodes one would need to visit to get from the current node to an empty node'

    The depth of a node in a tree is calculated from the root (depth 0) to where the node is. On the other hand, height is calculated from the furthest leaf node (height 0) to the level at which the node is. While it's not exactly what is described by the problem, I feel height is more resemblant of what is being asked.

  • Default User Avatar

    I knew there must have been a better way than to copy and paste the code for each of the 9 digits... after looking at other people's solutions I see now this could have been executed much much much more elegantly, haha!

  • Default User Avatar

    got it, thanks for the tips! still new at this, hah!

  • Custom User Avatar

    You're welcome.
    Also since this isn't an issue with the kata, you should mark it as resolved.
    You can do that using the checkbox when making a reply to your comment.

  • Default User Avatar

    Same, I also did a chunky and ugly looking loop that checks against a list of month names haha... it looks like a disgrace next to this solution. But that's what's so cool about codewars! You're learning new practices all the time :)

  • Default User Avatar

    Wow, thanks, that solved it for me -- I didn't even think about that :)

  • Custom User Avatar

    Maybe you should also console.log the enteredCode and correctCode?

  • Custom User Avatar

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