Float64Array
Creates a new Float64Array typed array representing an array of 64-bit IEEE floating point numbers (same precision as JavaScript numbers)
Syntax
new Float64Array(length) or new Float64Array(buffer, byteOffset?, length?)Parameters
| Parameter | Type | Description |
|---|---|---|
| length | number | ArrayBuffer | ArrayLike<number> | Array length, buffer, or array-like source |
Return Value
A new Float64Array instance
Examples
const arr = new Float64Array([Math.PI, Math.E, Math.SQRT2])
console.log(arr)const coords = new Float64Array(6)
coords.set([40.7128, -74.0060, 51.5074, -0.1278, 35.6762, 139.6503])
console.log('NYC lat:', coords[0])function dotProduct(a: Float64Array, b: Float64Array): number {
let sum = 0
for (let i = 0; i < a.length; i++) sum += a[i] * b[i]
return sum
}Understanding Float64Array
The Float64Array method in JavaScript creates a new Float64Array typed array representing an array of 64-bit IEEE floating point numbers (same precision as JavaScript numbers). 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 Float64Array(length) or new Float64Array(buffer, byteOffset?, length?). It accepts 1 parameter: length. When called, it returns a new float64array instance. Understanding when and how to use Float64Array() helps you write more expressive, readable code.
Common use cases for Float64Array include data transformation, input validation, API response processing, and building reusable utility functions. It works well alongside related methods like float32array-constructor, arraybuffer-constructor, uint32array-constructor, enabling you to chain operations together for complex data manipulation pipelines.
Browser support for Float64Array is excellent across all modern browsers including Chrome, Firefox, Safari, and Edge. It is also fully supported in Node.js and Deno. For older environments, transpilation with Babel or a polyfill may be needed.
Browser Compatibility
Supported in all modern browsers (Chrome, Firefox, Safari, Edge) and Node.js. Part of the ECMAScript standard.
Related Methods
Float32ArrayCreates a new Float32Array typed array representing an array of 32-bit IEEE floating point numbers
ArrayBufferCreates a new ArrayBuffer of the given length in bytes, with contents initialized to zero
Uint32ArrayCreates a new Uint32Array typed array representing an array of 32-bit unsigned integers
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.