Ad
  • Custom User Avatar

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

  • Custom User Avatar

    Nope that's not the goal. The problem with looking at other people's solutions is that they might be further down the line in expertise. Like Dahlia said, it will become more natural with time.

    My coding instructor taught us to try to achieve succinct code in this manner, in sequential order:

    1. it works
    2. it works well
    3. clearly it works well

    And ultimately, don't strive to cram everything in one line. I think that's just being silly. Yes it's cool, but a lot of times I'll find a one-liner to be not as human readable as a 3-5 liner. The goal is to strike a good balance between readability and efficiency. (And more lines of code doesn't necessarily mean less efficient code - a nested for loop takes only 5 lines in JavaScript but can be really inefficient.)

  • Custom User Avatar

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

  • Custom User Avatar

    In case anyone is wondering (like I was) how Math.min.apply(null, numbers) works, have a read at MDN's documentation for apply() - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/apply