--- title: DataView.prototype.setFloat32() slug: Web/JavaScript/Reference/Global_Objects/DataView/setFloat32 translation_of: Web/JavaScript/Reference/Global_Objects/DataView/setFloat32 ---
setFloat32()
从
DataView
起始位置以byte为计数的指定偏移量(byteOffset)处储存一个32-bit数(浮点型).
{{EmbedInteractiveExample("pages/js/dataview-setfloat32.html")}}
dataview.setFloat32(byteOffset, value [, littleEndian])
{{jsxref("undefined")}}.
var buffer = new ArrayBuffer(8); var dataview = new DataView(buffer); dataview.setFloat32(1, 3); dataview.getFloat32(1); // 3
Specification | Status | Comment |
---|---|---|
{{SpecName('Typed Array')}} | {{Spec2('Typed Array')}} | Superseded by ECMAScript 6. |
{{SpecName('ES6', '#sec-dataview.prototype.setfloat32', 'DataView.prototype.setFloat32')}} | {{Spec2('ES6')}} | Initial definition in an ECMA standard. |
{{SpecName('ESDraft', '#sec-dataview.prototype.setfloat32', 'DataView.prototype.setFloat32')}} | {{Spec2('ESDraft')}} |
{{Compat("javascript.builtins.DataView.setFloat32")}}