Javascript DataView getUint16()

Introduction

The Javascript DataView getUint16() method gets an unsigned 16-bit integer at the specified byte offset from the DataView.

dataview.getUint16(byteOffset [, littleEndian])
  • byteOffset - the offset, in byte, from the start of the view.
  • littleEndian - Optional, boolean value. If false or undefined, a big-endian value is read. Otherwise use the little endian.

Using the getUint16 method

var buffer = new ArrayBuffer(8);
var dataview = new DataView(buffer);
let a = dataview.getUint16(1); // 0
console.log(a);/*from w  ww .ja  v a 2s .com*/



PreviousNext

Related