--- title: SharedArrayBuffer.prototype.byteLength slug: Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer/byteLength tags: - JavaScript - Property - Shared Memory - SharedArrayBuffer - TypedArrays translation_of: Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer/byteLength --- <div>{{JSRef}}</div> <p><strong><code>byteLength</code></strong> アクセサープロパティは 、{{jsxref("SharedArrayBuffer")}} の長さをバイト単位で表します。</p> <div>{{EmbedInteractiveExample("pages/js/sharedarraybuffer-bytelength.html","shorter")}}</div> <div class="hidden">このデモのソースファイルは GitHub リポジトリに格納されています。デモプロジェクトに協力したい場合は、 <a href="https://github.com/mdn/interactive-examples">https://github.com/mdn/interactive-examples</a> をクローンしてプルリクエストを送信してください。</div> <h2 id="Description" name="Description">解説</h2> <p><code>byteLength</code> プロパティは、セットアクセサー関数が <code>undefined</code> であるアクセサープロパティです。つまり、このプロパティは読み取り専用です。値は共有配列が生成されたときに決定され、変更できません。</p> <h2 id="Examples" name="Examples">例</h2> <h3 id="Using_byteLength" name="Using_byteLength">byteLength の使用</h3> <pre class="brush:js notranslate">var sab = new SharedArrayBuffer(1024); sab.byteLength; // 1024 </pre> <h2 id="Specifications" name="Specifications">仕様書</h2> <table class="standard-table"> <tbody> <tr> <th scope="col">仕様書</th> </tr> <tr> <td>{{SpecName('ESDraft', '#sec-get-sharedarraybuffer.prototype.bytelength', 'SharedArrayBuffer.prototype.byteLength')}}</td> </tr> </tbody> </table> <h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの互換性</h2> <p>{{Compat("javascript.builtins.SharedArrayBuffer.byteLength")}}</p> <h2 id="See_also" name="See_also">関連情報</h2> <ul> <li>{{jsxref("SharedArrayBuffer")}}</li> </ul>