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

DataView.prototype.getInt8() - 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.getInt8()

Baseline Widely available

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

DataView getInt8() DataView 1 8 .

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
getInt8(byteOffset)

byteOffset

().

-128 127

RangeError

byteOffset .

getInt8()

js
const { buffer } = new Uint8Array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);
const dataview = new DataView(buffer);
console.log(dataview.getInt8(1)); // 1

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


Web Proxy Viewer  |  New URL  |  Original Page