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.
byteLength
アクセサープロパティは、SharedArrayBuffer
の長さをバイト単位で表します。
試してみましょう
// Create a SharedArrayBuffer with a size in bytes
const buffer = new SharedArrayBuffer(8);
console.log(buffer.byteLength);
// Expected output: 8
解説
byteLength
プロパティは、 set アクセサー関数が 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 GitHubdesktop | mobile | server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
byteLength |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.