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.

La propriété d'accesseur byteLength représente la longueur d'un SharedArrayBuffer exprimée en octets.

Exemple interactif

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

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

Syntaxe

js
sab.byteLength;

Description

La propriété byteLength est une propriété d'accesseur dont le mutateur associé vaut undefined. Autrement dit, cette propriété est en lecture seule. La valeur est établie lorsque le tableau partagé est construit et elle ne peut être modifiée par la suite.

Exemples

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

Spécifications

Specification
ECMAScript® 2025 Language Specification
# sec-get-sharedarraybuffer.prototype.bytelength

Compatibilité des navigateurs

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

Voir aussi