I want to pass only a part of array into another array through spread operator.
I tried passing an entire array into another array with spread operator.It worked.
let array1 = [1,2,3,4,5];
let array2 = [...array1, 6,7,8];
console.log(array2);
I expect to pass only first 3 elements of array [1,2,3] through spread operator into another array. How to do that?