The Javascript DataView setUint8() method stores an unsigned 8-bit integer value at the specified offset to the DataView.
dataview.setUint8(byteOffset, value)
byteOffset
- the offset, in byte, from the start of the view where to store the data.value
The value to set.Using the setUint8 method
var buffer = new ArrayBuffer(8); var dataview = new DataView(buffer); dataview.setUint8(1, 3);/* w ww . jav a 2 s . co m*/ let a = dataview.getUint8(1); // 3 console.log(a);