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

브라우저 호환성

같이 보기