Comment

Comment by mitt_romney_12

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 []
     };
  }

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton