Hacker News new | ask | show | jobs
by mitt_romney_12 896 days ago
If you replace the ternary with an if then it's easy to understand for anyone who knows what ... means (which imo every JS developer should know)

  const count = (amount: number) => {
    if (amount > 0) {
      return [...count(amount - 1), amount]
     } else {
      return []
     };
  }
1 comments

You missed the point entirely I’m afraid. It’s not about replacing the if with …, it’s about complexity.