Javascript DataView getInt16()

Introduction

The Javascript DataView getInt16() method gets a signed 16-bit integer, short, at the specified byte offset from the DataView.

dataview.getInt16(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 getInt16 method

var buffer = new ArrayBuffer(8);
var dataview = new DataView(buffer);
let a = dataview.getInt16(1); 
console.log(a);/*from  w w w . j  a  v a 2s .c o m*/



PreviousNext

Related