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 December 2021.

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® 2025 Language Specification
# sec-get-sharedarraybuffer.prototype.bytelength

브라우저 호환성

Report problems with this compatibility data on GitHub
desktopmobileserver
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Deno
Node.js
byteLength

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support

같이 보기