UNB/ CS/ David Bremner/ teaching/ cs2613/ books/ mdn/ Reference/ Global Objects/ DataView/ DataView.prototype.setUint8()

The setUint8() method of DataView instances takes a number and stores it as an 8-bit unsigned integer in the byte at the specified byte offset of this DataView.

Syntax

setUint8(byteOffset, value)

Parameters

Return value

undefined.

Exceptions

Examples

Using setUint8()

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

Specifications

Browser compatibility

See also