[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/byteLength [Back]  [Original]

TypedArray.prototype.byteLength - JavaScript | MDN

This page was translated from English by the community. Learn more and join the MDN Web Docs community.

View in English Always switch to English

TypedArray.prototype.byteLength

Baseline Widely available

This feature is well established and works across many devices and browser versions. Its been available across browsers since 2015 7.

byteLength () .

In this article

// Create an ArrayBuffer with a size in bytes
const buffer = new ArrayBuffer(8);
const uint8 = new Uint8Array(buffer, 2);

console.log(uint8.byteLength);
// Expected output: 6

byteLength undefined . TypedArray . TypedArray byteOffset length ArrayBuffer length . TypedArray TypedArray .

byteLength

js
const buffer = new ArrayBuffer(8);

const uint8 = new Uint8Array(buffer);
uint8.byteLength; // 8 (buffer byteLength )

const uint8newLength = new Uint8Array(buffer, 1, 5);
uint8newLength.byteLength; // 5 (Uint8Array    )

const uint8offSet = new Uint8Array(buffer, 2);
uint8offSet.byteLength; // 6 ( Uint8Array  )

Specification
ECMAScript 2027 LanguageSpecification
# sec-get-%typedarray%.prototype.bytelength


Web Proxy Viewer  |  New URL  |  Original Page