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

SharedArrayBuffer.prototype.byteLength

Baseline Widely available

This feature is well established and works across many devices and browser versions. Itโ€™s been available across browsers since โจ2021๋…„ 12์›”โฉ.

SharedArrayBuffer ์ธ์Šคํ„ด์Šค์˜ byteLength ์ ‘๊ทผ์ž ์†์„ฑ์€ ์ด SharedArrayBuffer์˜ ๋ฐ”์ดํŠธ ๋‹จ์œ„ ๊ธธ์ด๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.

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

// Create a SharedArrayBuffer with a size in bytes
const buffer = new SharedArrayBuffer(8);

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

์„ค๋ช…

byteLength ์†์„ฑ์€ ์ ‘๊ทผ์ž ์†์„ฑ์œผ๋กœ ์„ค์ • ์ ‘๊ทผ์ž ํ•จ์ˆ˜๋Š” undefined์ž…๋‹ˆ๋‹ค. ์ฆ‰, ์ด ์†์„ฑ์€ ์ฝ๊ธฐ ์ „์šฉ์ž…๋‹ˆ๋‹ค. ์ด ๊ฐ’์€ ๊ณต์œ  ๋ฐฐ์—ด์ด ์ƒ์„ฑ๋ ๋•Œ ๊ฐ’์ด ์„ค์ •๋˜๋ฉฐ, ๋ณ€๊ฒฝํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.

์˜ˆ์ œ

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

js
const sab = new SharedArrayBuffer(1024);
sab.byteLength; // 1024

๋ช…์„ธ์„œ

Specification
ECMAScriptยฎ 2026 Language Specification
# sec-get-sharedarraybuffer.prototype.bytelength

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

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