0

I wanted to know if these two syntaxes are equivalent:

x = [1, 2, 3]
y = [4, 5, 6]

a = [...x, ...y]
b = [].concat(x, y)

I couldn't find any way in which one is better than the other one.

Solomon Ucko
  • 5,724
  • 3
  • 24
  • 45
Santiago
  • 641
  • 3
  • 14
  • Your `concat` approach creates one Array more than your spread approach. Other than that, the results are equivalent for Arrays. – Sebastian Simon Feb 15 '23 at 14:11

0 Answers0