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

DataView() - 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()

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

In this article

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

// Create a couple of views
const view1 = new DataView(buffer);
const view2 = new DataView(buffer, 12, 4); // From byte 12 for the next 4 bytes
view1.setInt8(12, 42); // Put 42 in slot 12

console.log(view2.getInt8(0));
// Expected output: 42

js
    new DataView(buffer [, byteOffset [, byteLength]])

buffer

DataView ArrayBuffer SharedArrayBuffer .

byteOffset Optional

. .

byteLength Optional

. .

DataView .

DataView "" . DataView , / , .

RangeError

byteOffset byteLength . , 16 byteOffset 8, byteLength 10 18 2 .

Specification
ECMAScript 2027 LanguageSpecification
# sec-dataview-constructor


Web Proxy Viewer  |  New URL  |  Original Page