SharedArrayBuffer was disabled by default in all major browsers on 5 January, 2018 in response to Spectre. Chrome re-enabled it in v67 on platforms where its site-isolation feature is enabled to protect against Spectre-style vulnerabilities.
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.
- The size, in bytes, of the array buffer to create.
SharedArrayBuffer object of the specified size. Its contents are initialized to 0.
Always use the new operator to create a SharedArrayBuffer
var sab = SharedArrayBuffer(1024); // TypeError: calling a builtin SharedArrayBuffer constructor // without new is forbidden
var sab = new SharedArrayBuffer(1024);
|ECMAScript Latest Draft (ECMA-262)
The definition of 'SharedArrayBuffer constructor' in that specification.