| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Global_Objects/DataView/byteLength | [Back] [Original] |
Get to know MDN better
This page was translated from English by the community. Learn more and join the MDN Web Docs community.
This feature is well established and works across many devices and browser versions. Its been available across browsers since 2015 ..
- byteLength DataView .
// Create an ArrayBuffer with a size in bytes
const buffer = new ArrayBuffer(16);
const view1 = new DataView(buffer);
const view2 = new DataView(buffer, 12, 4); // From byte 12 for the next 4 bytes
console.log(view1.byteLength + view2.byteLength); // 16 + 4
// Expected output: 20
byteLength . DataView . DataView byteOffset byteLength, byteLength ArrayBuffer SharedArrayBuffer.
const buffer = new ArrayBuffer(8);
const dataview = new DataView(buffer);
dataview.byteLength; // 8 ( byteLength )
const dataview2 = new DataView(buffer, 1, 5);
dataview2.byteLength; // 5 ( DataView)
const dataview3 = new DataView(buffer, 2);
dataview3.byteLength; // 6 (- byteOffset, DataView)
| Specification |
|---|
| ECMAScript 2027 LanguageSpecification # sec-get-dataview.prototype.bytelength |
This page was last modified on 17 . 2025 . by MDN contributors.
DataViewgetBigInt64()getBigUint64()getFloat16()getFloat32()getFloat64()getInt8()getInt16()getInt32()getUint8()getUint16()getUint32()setBigInt64()setBigUint64()setFloat16()setFloat32()setFloat64()DataView.prototype.setInt8()DataView.prototype.setInt16()DataView.prototype.setInt32()setUint8()setUint16()setUint32()Object/FunctionObject.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.toString()Object.prototype.valueOf()Your blueprint for a better internet.
Portions of this content are 19982026 by individual mozilla.org contributors. Content available under a Creative Commons license.
| Web Proxy Viewer | New URL | Original Page |