The Javascript BigUint64Array subarray()
method returns a sub typed array for this BigUint64Array object.
BigUint64Array.subarray([begin [,end]])
Parameter | Optional | Meaning |
---|---|---|
begin | Optional | Element to begin at. The offset is inclusive. The whole array is returned if this value is not specified. |
end | Optional | index to end. The offset is exclusive. If not specified, all elements from begin to the end of the array are included in the new array. |
Using the subarray method
var buffer = new ArrayBuffer(8); var uint8 = new BigUint64Array(buffer); uint8.set([1,2,3]);//from www. j a va 2 s.com console.log(uint8); // BigUint64Array [ 12n, 5n, 8n, 130n, 44n, 0, 0, 0, 0, 0 ] var sub = uint8.subarray(0,4); console.log(sub); // BigUint64Array [ 12n, 5n, 8n, 130n, 44n, 0 ]