How to copy TypedArray into another TypedArray?

前端 未结 3 1220
无人共我
无人共我 2021-01-17 10:15

C# has a high performance array copying function to copy arrays in place:

Array.Copy(source, destination, length)

It\'s faster tha

3条回答
  •  囚心锁ツ
    2021-01-17 11:10

    clone to an exist typedarray:

    destination.set(source);
    destination.set(source, offset);
    

    clone to a new typedarray example: (It's fastest!)

    var source = new Uint8Array([1,2,3]);
    var cloned = new Uint8Array(source);
    

提交回复
热议问题