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
.
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. |
| Desktop | Mobile | Server | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
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 |
完整支持
ArrayBuffer
ArrayBuffer.isView()
ArrayBuffer.prototype.slice()
Function
Object
Object.prototype.__defineGetter__()
Object.prototype.__defineSetter__()
Object.prototype.__lookupGetter__()
Object.prototype.__lookupSetter__()
Object.prototype.hasOwnProperty()
Object.prototype.isPrototypeOf()
Object.prototype.propertyIsEnumerable()
Object.prototype.toLocaleString()
Object.prototype.toSource()
Object.prototype.toString()
Object.prototype.valueOf()
Object.setPrototypeOf()