JS Built-ins
SharedArrayBufferbeginner

SharedArrayBuffer β€” .byteLength property

πŸ“– Usage Example
const sab = new SharedArrayBuffer(4)
const view = new Int32Array(sab)
view[0] = 42
view[0]  // β†’ 42

Wrap a SharedArrayBuffer in a typed array to read and write its contents.

SharedArrayBuffer byteLength

The .byteLength property returns the size in bytes of the buffer.

Challenge: Verify that .byteLength equals the size passed to the constructor.

πŸ’‘ Hints (1)
  • β€’ The byteLength property returns the size of the buffer in bytes.