The SharedArrayBuffer()
constructor can create a SharedArrayBuffer object representing a generic, fixed-length raw binary data buffer.
SharedArrayBuffer is similar to the ArrayBuffer object.
new SharedArrayBuffer([length])
Parameter | Optional | Meaning |
---|---|---|
length | Yes | The size, in bytes, of the array buffer to create. |
A new SharedArrayBuffer object of the specified size.
Its contents are initialized to 0.
let sab = new SharedArrayBuffer(1024);
console.log(sab.byteLength);