The ArrayBuffer.isView()
method determines whether the passed value is one of the ArrayBuffer
views, such as typed array objects or a DataView
.
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.
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
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Desktop | Mobile | Server | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
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