Concat arrays via destructuring
Concat arrays via destructuring
For concatenating or merging two or more arrays, you can use the destructuring technique.
With this technique essentially you are going to unpack the arrays into a list of distinct variables, and use this list to recreate a new array with square brackets.
You can use this technique with more than 2 arrays:
The order you are using the [...array1, ...array2, ...array3]
is important because determines the order of the items for the new array