This page was translated from English by the community.Learn more and join the MDN Web Docs community.
TypedArray.prototype.buffer
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2015년 7월.
buffer 접근자 속성은 생성 시TypedArray에서 참조하는ArrayBuffer를 나타냅니다.
In this article
시도해 보기
// Create an ArrayBuffer with a size in bytesconst buffer = new ArrayBuffer(8);const uint16 = new Uint16Array(buffer);console.log(uint16.buffer.byteLength);// Expected output: 8설명
buffer 속성은 set 접근자 함수가undefined인 속성으로, 이 속성은 읽을수만 있습니다. 값은TypedArray가 생성될 때 설정되어 변경할 수 없습니다.TypedArray는TypedArray 객체 중 하나입니다.
예제
>buffer 속성 사용하기
js
const buffer = new ArrayBuffer(8);const uint16 = new Uint16Array(buffer);uint16.buffer; // ArrayBuffer { byteLength: 8 }잘린 배열 보기에서 기반 버퍼에 액세스하기
js
const buffer = new ArrayBuffer(1024);const arr = new Uint8Array(buffer, 64, 128);console.log(arr.byteLength); // 128console.log(arr.buffer.byteLength); // 1024console.log(arr.buffer === buffer); // true명세서
| Specification |
|---|
| ECMAScript® 2026 Language Specification> # sec-get-%typedarray%.prototype.buffer> |