ArrayBuffer.isView()
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 Language Specification # sec-arraybuffer.isview |
Browser compatibility
Report problems with this compatibility data on GitHubdesktop | mobile | server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
isView | ChromeFull support32 | EdgeFull support12 | FirefoxFull support29 | Internet ExplorerFull support11 | OperaFull support19 | SafariFull support7 | WebView AndroidFull support37 | Chrome AndroidFull support32 | Firefox for AndroidFull support29 | Opera AndroidFull support19 | Safari on iOSFull support7 | Samsung InternetFull support2.0 | DenoFull support1.0 | Node.jsFull support4.0.0 |
Legend
- Full support
- Full support
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.