ArrayBuffer.isView()
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
TheArrayBuffer.isView() static method determines whether thepassed value is one of theArrayBuffer views,such astyped array objectsor aDataView.
In this article
Try it
// Create an ArrayBuffer with a size in bytesconst buffer = new ArrayBuffer(16);console.log(ArrayBuffer.isView(new Int32Array()));// Expected output: trueSyntax
js
ArrayBuffer.isView(value)Parameters
valueThe value to be checked.
Return value
true if the given argument is one of theArrayBuffer views;otherwise,false.
Examples
>Using isView
js
ArrayBuffer.isView(); // falseArrayBuffer.isView([]); // falseArrayBuffer.isView({}); // falseArrayBuffer.isView(null); // falseArrayBuffer.isView(undefined); // falseArrayBuffer.isView(new ArrayBuffer(10)); // falseArrayBuffer.isView(new Uint8Array()); // trueArrayBuffer.isView(new Float32Array()); // trueArrayBuffer.isView(new Int8Array(10).subarray(0, 3)); // trueconst buffer = new ArrayBuffer(2);const dv = new DataView(buffer);ArrayBuffer.isView(dv); // trueSpecifications
| Specification |
|---|
| ECMAScript® 2026 Language Specification> # sec-arraybuffer.isview> |
Browser compatibility
See also
- JavaScript typed arrays guide