Ad
  • Default User Avatar

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

  • Default User Avatar

    Thanks for the question!

    At the time I was doing this problem, I had challenges using ternary operators in general. So I tried my best, each time a solution required an if/else statement (as above), to refactor it and write it using a ternary operator.

    I suppose the better way would have ben to submit the first function and then also submit the second solution...but I wanted them side-by-side (at least for this problem) to help me understand ternary operators a bit better.