I have an array
array1 = [1,2,3,6,7,8]
array2 = [40,50]
How can i push items in array2 to array1 to get a result
result = [1,2,3,40,50,6,7,8];
keep in mind its not a simple concatination, need to insert the scecond array in specific index.
array1.splice(3, 0, array1 ); => splice doesnt accept another array.
How can i enter items in diffrent array to a specific index?
Im trying this in angular
array1 .splice(3, 0,...array2);
and getting the im getting spread array doesn't support in tslib
array1.splice(3, 0, ...array2);will do the job, although this will alterarray1, so I'm assuming you wantarray1to beresult. Of course, I also assume that your environment supports the spread operator.array1or do you want to create a new array that is the result of the concatenation?