18.
How can the spread operator be used to concatenate two arrays in JavaScript ES6?
[array1, ...array2]
[...array1, array2]
...[array1, array2]
[...array1, ...array2]
Correct: D
The spread operator can be used to concatenate two arrays by spreading the elements of both arrays into a new array. This can be done using the [...array1, ...array2] syntax or by using the concat method like array1.concat(array2). Using the spread operator preserves the original arrays and creates a new array with all the elements.