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

ArrayBuffer.prototype.maxByteLength

Baseline 2024
Newly available

Since โจJuly 2024โฉ, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.

ArrayBuffer ์ธ์Šคํ„ด์Šค์˜ maxByteLength ์ ‘๊ทผ์ž ์†์„ฑ์€ ๋ฐฐ์—ด ๋ฒ„ํผ์˜ ํฌ๊ธฐ ์กฐ์ ˆ์ด ๊ฐ€๋Šฅํ•œ ๋ฐ”์ดํŠธ ๋‹จ์œ„์˜ ์ตœ๋Œ€ ๊ธธ์ด๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.

์‹œ๋„ํ•ด ๋ณด๊ธฐ

const buffer = new ArrayBuffer(8, { maxByteLength: 16 });

console.log(buffer.byteLength);
// Expected output: 8

console.log(buffer.maxByteLength);
// Expected output: 16

์„ค๋ช…

maxByteLength ์ ‘๊ทผ์ž ์†์„ฑ์€ ์„ค์ • ์ ‘๊ทผ์ž ํ•จ์ˆ˜๊ฐ€ undefined์œผ๋กœ, ์ด ์†์„ฑ์€ ์ฝ์„ ์ˆ˜๋งŒ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด ๊ฐ’์€ ๋ฐฐ์—ด์ด ์ƒ์„ฑ๋  ๋•Œ ์„ค์ •๋˜๋ฉฐ, ArrayBuffer() ์ƒ์„ฑ์ž์˜ maxByteLength ์˜ต์…˜์„ ํ†ตํ•ด ์„ค์ •๋˜๋ฉฐ ๋ณ€๊ฒฝํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.

์ด ArrayBuffer๊ฐ€ ๋ถ„๋ฆฌ๋œ ๊ฒฝ์šฐ ์ด ์†์„ฑ์€ 0์„ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค. maxByteLength ๊ฐ’์„ ์ง€์ •ํ•˜์ง€ ์•Š๊ณ  ArrayBuffer๊ฐ€ ์ƒ์„ฑ๋œ ๊ฒฝ์šฐ ์ด ์†์„ฑ์€ ArrayBuffer์˜ byteLength์˜ ๊ฐ’๊ณผ ๊ฐ™์€ ๊ฐ’์„ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.

์˜ˆ์ œ

maxByteLength ์‚ฌ์šฉํ•˜๊ธฐ

์ด ์˜ˆ์ œ์—์„œ ์ตœ๋Œ€ ํฌ๊ธฐ๊ฐ€ 16๋ฐ”์ดํŠธ๊นŒ์ง€ ํฌ๊ธฐ ์กฐ์ ˆ์ด ๊ฐ€๋Šฅํ•œ 8๋ฐ”์ดํŠธ ๋ฒ„ํผ๋ฅผ ๋งŒ๋“ค๊ณ  ์ด ๋ฒ„ํผ์˜ maxByteLength๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.

js
const buffer = new ArrayBuffer(8, { maxByteLength: 16 });

buffer.maxByteLength; // 16

๋ช…์„ธ์„œ

Specification
ECMAScriptยฎ 2026 Language Specification
# sec-get-arraybuffer.prototype.maxbytelength

๋ธŒ๋ผ์šฐ์ € ํ˜ธํ™˜์„ฑ

๊ฐ™์ด ๋ณด๊ธฐ