ArrayBuffer.isView() method determines whether the passed value is one of the ArrayBuffer views, such as typed array objects 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.

句法

ArrayBuffer.isView(value)
					

参数

value

The value to be checked.

返回值

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

范例

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
					

规范

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

浏览器兼容性

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. 更新 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 32 Edge 12 Firefox 29 IE 11 Opera 19 Safari 7 WebView Android ≤37 Chrome Android 32 Firefox Android 29 Opera Android 19 Safari iOS 7 Samsung Internet Android 2.0 nodejs 4.0.0

图例

完整支持

完整支持

另请参阅

元数据

  • 最后修改: