DataView.prototype.setFloat64()
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
setFloat64()
从 DataView
起始位置以 byte 为计数的指定偏移量 (byteOffset) 处储存一个 64-bit 数 (双精度浮点型)。
尝试一下
语法
dataview.setFloat64(byteOffset, value [, littleEndian])
参数
- byteOffset
-
偏移量,从头开始计算,单位为字节。
- value
-
设置的数值。
- littleEndian
-
可选 Indicates whether the 64-bit float is stored in little- or big-endian format. If false or undefined, a big-endian value is written.
返回
抛出错误
RangeError
-
如果 byteOffset 超出了视图能储存的值,就会抛出错误。
示例
js
var buffer = new ArrayBuffer(8);
var dataview = new DataView(buffer);
dataview.setFloat64(0, 3);
dataview.getFloat64(0); // 3
规范
Specification |
---|
ECMAScript Language Specification # sec-dataview.prototype.setfloat64 |
浏览器兼容性
BCD tables only load in the browser