setUint16() method stores an unsigned 16-bit integer
(unsigned short) value at the specified byte offset from the start of the
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.
dataview.setUint16(byteOffset, value [, littleEndian])
- The offset, in byte, from the start of the view where to store the data.
- The value to set.
- Optional Indicates whether the 16-bit int is stored in
little- or big-endian format. If
undefined, a big-endian value is written.
- Thrown if the
byteOffsetis set such as it would store beyond the end of the view.
var buffer = new ArrayBuffer(8); var dataview = new DataView(buffer); dataview.setUint16(1, 3); dataview.getUint16(1); // 3
The definition of 'DataView.prototype.setUint16' in that specification.
BCD tables only load in the browser