I've searched through the answers here, but I can only find this question answered for other languages.
So I have 2 Uint8 typed arrays.
var arr1 = [0,0,0];
var arr2 = [0,1,2,3,4,5,6,7,8,9];
I want to replace the contents of arr2 with arr1 starting at the 4th position. So that arr2 will be:
arr2 = [0,1,2,0,0,0,6,7,8,9];
If I wasn't trying to do this in the middle of the array I could use set like this:
arr2.set(arr1);
And I would get:
arr2 = [0,0,0,4,5,6,7,8,9];
I know I can loop through the arr2 and individually copy the values, but performance wise this is very slow compared to set (and performance matters to me because it's copying an entire array of canvas img data 24 times a second).
Is there any function that can copy into the middle of an array, but with the performance of set?