Web/JavaScript/Reference/Global objects/ArrayBuffer/isView

From Get docs


The ArrayBuffer.isView() method determines whether the passed value is one of the ArrayBuffer views, such as typed array objects or a DataView.


Syntax

ArrayBuffer.isView(value)

Parameters

value
The value to be checked.

Return value

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

Examples

Using isView

ArrayBuffer.isView();                    // false              
ArrayBuffer.isView([]);                  // false
ArrayBuffer.isView({});                  // false
ArrayBuffer.isView(null);                // false
ArrayBuffer.isView(undefined);           // false
ArrayBuffer.isView(new ArrayBuffer(10)); // false
 
ArrayBuffer.isView(new Uint8Array());    // true
ArrayBuffer.isView(new Float32Array());  // true
ArrayBuffer.isView(new Int8Array(10).subarray(0, 3)); // true

const buffer = new ArrayBuffer(2);
const dv = new DataView(buffer);
ArrayBuffer.isView(dv); // true

Specifications

Specification
ECMAScript (ECMA-262)The definition of 'ArrayBuffer.isView' in that specification.

Browser compatibility

Update compatibility data on GitHub

Desktop Mobile Server
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet Node.js
isView Chrome

Full support 32

Edge

Full support 12

Firefox

Full support 29

IE

Full support 11

Opera

Full support 19

Safari

Full support 7

WebView Android

Full support ≤37

Chrome Android

Full support 32

Firefox Android

Full support 29

Opera Android

Full support 19

Safari iOS

Full support 7

Samsung Internet Android

Full support 2.0

nodejs

Full support 4.0.0

Legend

Full support  
Full support


See also