[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Global_Objects/DataView/setInt8 [Back]  [Original]

DataView.prototype.setInt8() - JavaScript | MDN

This page was translated from English by the community. Learn more and join the MDN Web Docs community.

View in English Always switch to English

DataView.prototype.setInt8()

Baseline Widely available

This feature is well established and works across many devices and browser versions. Its been available across browsers since 2015 ..

setInt8() DataView 8- , DataView.

In this article

// Create an ArrayBuffer with a size in bytes
const buffer = new ArrayBuffer(16);

const view = new DataView(buffer);
view.setInt8(1, 127); // Max signed 8-bit integer

console.log(view.getInt8(1));
// Expected output: 127

js
setInt8(byteOffset, value)

byteOffset

DataView, .

value

. .

undefined.

RangeError

, byteOffset DataView.

setInt8()

js
const buffer = new ArrayBuffer(10);
const dataview = new DataView(buffer);
dataview.setInt8(0, 3);
dataview.getInt8(0); // 3

Specification
ECMAScript 2027 LanguageSpecification
# sec-dataview.prototype.setint8


Web Proxy Viewer  |  New URL  |  Original Page