Returns a new Int8Array view of the same backing ArrayBuffer for this typed array, referencing the elements starting from the specified starting index and up to, but not including, the specified ending index.
subarray(start?, end?)
start optional
The index of the beginning of the array. If not specified, starts with 0.
end optional
The index of the end of the array. If not specified, ends with the length of the array.
a = new Int8Array([8, 16, 32, 64])
b = a.subarray(1, 3)
print("a:", a)
print("b:", b)
// Changing only a also affects b
// because they shared the same ArrayBuffer.
a[2] = 111
print("a:", a)
print("b:", b)
a: 8,16,32,64
b: 16,32
a: 8,16,111,64
b: 16,111