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

TypedArray.prototype.length - 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.length

Baseline Widely available

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

TypedArray length .

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.length);
// Expected output: 6

length undefined , . TypedArray . TypeArray byteOffset length ArrayBuffer . TypeArray TypeArray .

length

js
const buffer = new ArrayBuffer(8);

let uint8 = new Uint8Array(buffer);
uint8.length; // 8 (  )

uint8 = new Uint8Array(buffer, 1, 5);
uint8.length; // 5 (Uint8Array    )

uint8 = new Uint8Array(buffer, 2);
uint8.length; // 6 ( Uint8Array  )

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


Web Proxy Viewer  |  New URL  |  Original Page