Javascript BigUint64Array byteLength

Introduction

The Javascript BigUint64Array byteLength property returns the length in bytes of a typed array.

BigUint64Array.byteLength

The Javascript BigUint64Array byteLength property is a read only property.

The value is set when a BigUint64Array is created and cannot be changed.

If the BigUint64Array is not specifying an byteOffset or a length, the length of the referenced ArrayBuffer will be returned.

Using the Javascript BigUint64Array byteLength property

var buffer = new ArrayBuffer(8);

var uint8 = new BigUint64Array(buffer);
console.log(uint8.byteLength); // 8 (matches the byteLength of the buffer)

var uint8 = new BigUint64Array(buffer, 1, 5);
console.log(uint8.byteLength); // 5 (as specified when constructing the BigUint64Array)

var uint8 = new BigUint64Array(buffer, 2);
console.log(uint8.byteLength); // 6 (due to the offset of the constructed BigUint64Array)



PreviousNext

Related