The Float64Array
typed array represents an array of 64-bit floating point numbers in the platform byte order. If control over byte order is needed, use DataView
instead. The contents are initialized to 0
. Once established, you can reference elements in the array using the object's methods, or using standard array index syntax (that is, using bracket notation).
Float64Array
is a subclass of the hidden TypedArray
class.
Static methods
Inherits static methods from its parent TypedArray
.
Instance methods
Inherits instance methods from its parent TypedArray
.
Different ways to create a Float64Array
const float64 = new Float64Array(2);
float64[0] = 42;
console.log(float64[0]);
console.log(float64.length);
console.log(float64.BYTES_PER_ELEMENT);
const x = new Float64Array([21, 31]);
console.log(x[1]);
const y = new Float64Array(x);
console.log(y[0]);
const buffer = new ArrayBuffer(64);
const z = new Float64Array(buffer, 8, 4);
console.log(z.byteOffset);
const iterable = (function* () {
yield* [1, 2, 3];
})();
const float64FromIterable = new Float64Array(iterable);
console.log(float64FromIterable);
Specifications
Browser compatibility
|
Desktop |
Mobile |
Server |
|
Chrome |
Edge |
Firefox |
Opera |
Safari |
Chrome Android |
Firefox for Android |
Opera Android |
Safari on IOS |
Samsung Internet |
WebView Android |
Deno |
Node.js |
Float64Array |
7 |
12 |
4 |
11.6 |
5.1 |
18 |
4 |
12 |
4.2 |
1.0 |
4 |
1.0 |
0.10.0 |
Float64Array |
7 |
12 |
4 |
11.6 |
5.1 |
18 |
4 |
12 |
4.2 |
1.0 |
4 |
1.0 |
0.10.0 |