TypedArray

BigInt64Array

Creates a new BigInt64Array typed array representing an array of 64-bit signed BigInt integers

Syntax

JavaScript
new BigInt64Array(length) or new BigInt64Array(buffer, byteOffset?, length?)

Parameters

ParameterTypeDescription
lengthnumber | ArrayBuffer | ArrayLike<bigint>Array length, buffer, or array-like source

Return Value

A new BigInt64Array instance

Examples

Basic Usage
const arr = new BigInt64Array(2)
arr[0] = 9007199254740993n // beyond Number.MAX_SAFE_INTEGER
console.log(arr[0])
Practical Example
const arr = new BigInt64Array([100n, -200n, 300n])
console.log(arr.reduce((a, b) => a + b, 0n)) // 200n
Advanced Usage
const buffer = new ArrayBuffer(16)
const view = new BigInt64Array(buffer)
view[0] = BigInt(Number.MAX_SAFE_INTEGER) + 1n
console.log(view[0]) // 9007199254740992n

Understanding BigInt64Array

The BigInt64Array method in JavaScript creates a new BigInt64Array typed array representing an array of 64-bit signed BigInt integers. It belongs to the TypedArray object and is one of the most widely used methods for working with typedarray values in modern JavaScript and TypeScript applications.

The method signature is new BigInt64Array(length) or new BigInt64Array(buffer, byteOffset?, length?). It accepts 1 parameter: length. When called, it returns a new bigint64array instance. Understanding when and how to use BigInt64Array() helps you write more expressive, readable code.

Common use cases for BigInt64Array include data transformation, input validation, API response processing, and building reusable utility functions. It works well alongside related methods like biguint64array-constructor, int32array-constructor, arraybuffer-constructor, enabling you to chain operations together for complex data manipulation pipelines.

Supported in Chrome 67+, Firefox 68+, Safari 15+, Edge 79+, Node.js 10.4+.

Browser Compatibility

Supported in Chrome 67+, Firefox 68+, Safari 15+, Edge 79+, Node.js 10.4+.

Related Methods

More TypedArray Methods

Other methods in the TypedArray object

Related Tools

More TypedArray Methods

Explore JavaScript Methods

Browse our complete reference of 410 JavaScript methods with syntax, examples, and explanations.