Javascript SharedArrayBuffer() constructor

Introduction

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
lengthYes The size, in bytes, of the array buffer to create.

Return value

A new SharedArrayBuffer object of the specified size.

Its contents are initialized to 0.

let sab = new SharedArrayBuffer(1024);
console.log(sab.byteLength);



PreviousNext

Related