{{JSRef("Global_Objects", "TypedArray", "Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array")}}
Summary
The Float64Array
typed array represents an array of 64-bit floating point numbers (corresponding to the C double
data type) in the platform byte order. If control over byte order is needed, use {{jsxref("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).
Syntax
Float64Array(length); Float64Array(typedArray); Float64Array(object); Float64Array(buffer [, byteOffset [, length]]);
For more information about the constructor syntax and the parameters, see TypedArray.
Properties
- {{jsxref("TypedArray.BYTES_PER_ELEMENT", "Float64Array.BYTES_PER_ELEMENT")}}
-
Returns a number value of the element size.
8
in the case of anFloat64Array
. - Float64Array.length
- Length property whose value is 3.
- {{jsxref("TypedArray.name", "Float64Array.name")}}
-
Returns the string value of the constructor name. In the case of the
Float64Array
type: "Float64Array". - {{jsxref("TypedArray.prototype", "Float64Array.prototype")}}
- Prototype for the TypedArray objects.
Methods
- Float64Array.from()
- See {{jsxref("Array.from()")}}. Not implemented, see {{bug(896608)}}.
- Float64Array.of()
- See {{ jsxref("Array.of()")}}. Not implemented, see {{bug(896608)}}.
Float64Array
prototype
All Float64Array
objects inherit from {{jsxref("TypedArray.prototype", "%TypedArray%.prototype")}}.
Properties
-
Float64Array.prototype.constructor
-
Returns the function that created an instance's prototype. This is the
Float64Array
constructor by default. - {{jsxref("TypedArray.prototype.buffer", "Float64Array.prototype.buffer")}} {{readonlyInline}}
-
Returns the {{jsxref("ArrayBuffer")}} referenced by the
Float64Array
Fixed at construction time and thus read only. - {{jsxref("TypedArray.prototype.byteLength", "Float64Array.prototype.byteLength")}} {{readonlyInline}}
-
Returns the length (in bytes) of the
Float64Array
from the start of its {{jsxref("ArrayBuffer")}}. Fixed at construction time and thus read only. - {{jsxref("TypedArray.prototype.byteOffset", "Float64Array.prototype.byteOffset")}} {{readonlyInline}}
-
Returns the offset (in bytes) of the
Float64Array
from the start of its {{jsxref("ArrayBuffer")}}. Fixed at construction time and thus read only. - {{jsxref("TypedArray.prototype.length", "Float64Array.prototype.length")}} {{readonlyInline}}
-
Returns the number of elements hold in the
Float64Array
. Fixed at construction time and thus read only.
Methods
- {{jsxref("TypedArray.prototype.copyWithin()", "Float64Array.prototype.copyWithin()")}}
- See {{jsxref("Array.prototype.copyWithin()")}}.
- {{jsxref("TypedArray.prototype.entries()", "Float64Array.prototype.entries()")}}
-
Returns a new
Array Iterator
object that contains the key/value pairs for each index in the array. - {{jsxref("TypedArray.prototype.keys()", "Float64Array.prototype.keys()")}}
-
Returns a new
Array Iterator
that contains the keys for each index in the array. - {{jsxref("TypedArray.prototype.move()", "Float64Array.prototype.move()")}} {{non-standard_inline}} {{unimplemented_inline}}
- Former non-standard version of {{jsxref("TypedArray.prototype.copyWithin()", "Float64Array.prototype.copyWithin()")}}.
- {{jsxref("TypedArray.prototype.set()", "Float64Array.prototype.set()")}}
-
Stores multiple values in the
Float64Array
, reading input values from a specified array. - {{jsxref("TypedArray.prototype.subarray()", "Float64Array.prototype.subarray()")}}
-
Returns a new
Float64Array
from the given start and end element index. - {{jsxref("TypedArray.prototype.values()", "Float64Array.prototype.values()")}}
-
Returns a new
Array Iterator
object that contains the values for each index in the array. - {{jsxref("TypedArray.prototype.@@iterator()", "Float64Array.prototype[@@iterator]()")}}
-
Returns a new
Array Iterator
object that contains the values for each index in the array.
Examples
// From a length var float64 = new Float64Array(2); float64[0] = 42; console.log(float64[0]); // 42 console.log(float64.length); // 2 console.log(float64.BYTES_PER_ELEMENT); // 8 // From an array var arr = new Float64Array([21,31]); console.log(arr[1]); // 31 // From another TypedArray var x = new Float64Array([21, 31]); var y = new Float64Array(x); console.log(y[0]); // 21 // From an ArrayBuffer var buffer = new ArrayBuffer(32); var z = new Float64Array(buffer, 0, 4);
Specifications
Specification | Status | Comment |
---|---|---|
Typed Array Specification | Obsolete | Superseded by ECMAScript 6. |
{{SpecName('ES6', '#table-45', 'TypedArray constructors')}} | {{Spec2('ES6')}} | Initial definition in an ECMA standard. |
Browser compatibility
{{ CompatibilityTable() }}
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | 7.0 | {{ CompatGeckoDesktop("2") }} | 10 | 11.6 | 5.1 |
Feature | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Basic support | 4.0 | {{ CompatVersionUnknown() }} | {{ CompatGeckoMobile("2") }} | 10 | 11.6 | 4.2 |
See also
- JavaScript typed arrays
- {{jsxref("ArrayBuffer")}}
- {{jsxref("DataView")}}