Javascript ArrayBuffer isView()

Introduction

The Javascript ArrayBuffer.isView() method checks whether the passed value is one of the ArrayBuffer views.

ArrayBuffer.isView(value)
Parameter Optional Meaning
value RequiredThe value to be checked.

It returns true if the given argument is one of the ArrayBuffer views; otherwise, false.

let a = ArrayBuffer.isView();
console.log(a);//  w w w  . j  a v  a2  s . co  m
a = ArrayBuffer.isView([]);
console.log(a);
a = ArrayBuffer.isView({});
console.log(a);
a = ArrayBuffer.isView(null);
console.log(a);
a = ArrayBuffer.isView(undefined);
console.log(a);
a = ArrayBuffer.isView(new ArrayBuffer(10));
console.log(a);
a = ArrayBuffer.isView(new Uint8Array());
console.log(a);
a = ArrayBuffer.isView(new Float32Array());
console.log(a);
a = ArrayBuffer.isView(new Int8Array(10).subarray(0, 3));
console.log(a);
const buffer = new ArrayBuffer(2);
const dv = new DataView(buffer);
a = ArrayBuffer.isView(dv);



PreviousNext

Related