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