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

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

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 setUint8() 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.setUint8(1, 255); // Max unsigned 8-bit integer

console.log(view.getUint8(1));
// Expected output: 255

js
setUint8(byteOffset, value)

byteOffset

.

value

. .

undefined.

RangeError

byteOffset .

setUint8()

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

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


Web Proxy Viewer  |  New URL  |  Original Page