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

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

Baseline Widely available

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

buffer TypedArray ArrayBuffer .

In this article

// Create an ArrayBuffer with a size in bytes
const 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); // 128
console.log(arr.buffer.byteLength); // 1024
console.log(arr.buffer === buffer); // true

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


Web Proxy Viewer  |  New URL  |  Original Page