Ad
  • Default User Avatar

    If n was type of number, spread operator would not work with it (would throw error). Spread operators only work with arrays and string.

    BTW, your solution was clever and simple