| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Atomics/store | [Back] [Original] |
Get to know MDN better
// Create a SharedArrayBuffer with a size in bytes
const buffer = new SharedArrayBuffer(16);
const uint8 = new Uint8Array(buffer);
uint8[0] = 5;
console.log(Atomics.store(uint8, 0, 2));
// Expected output: 2
console.log(Atomics.load(uint8, 0));
// Expected output: 2
Atomics.store(typedArray, index, value)
typedArrayInt8ArrayUint8ArrayInt16ArrayUint16ArrayInt32ArrayUint32ArrayBigInt64Array BigUint64Array
indextypedArray value
valueTypeError typedArray
RangeError index typedArray
const sab = new SharedArrayBuffer(1024);
const ta = new Uint8Array(sab);
Atomics.store(ta, 0, 12); // 12
| ECMAScript 2027 LanguageSpecification # sec-atomics.store |
| Web Proxy Viewer | New URL | Original Page |