Standard built-ins

Atomics.store()

Try the free JavaScript compiler

Stores a converted integer value atomically. Use a shared buffer for communication between agents; the example checks operation semantics in Node.js, not inter-thread ordering.

Formal Syntax & Structure

javascript syntaxjavascript
Atomics.store(typedArray, index, value)

Parameters & Attributes

NameTypeDescription
typedArrayinteger TypedArrayInteger view; floating-point and clamped arrays are not accepted.
indexnumberElement index, not byte offset.
valuenumber | bigintOperand matching the view numeric type.

Return Value

number | bigint

Value returned by the store operation; the element uses its typed representation.

Working Example

Example Snippetjavascript
const a=new Int32Array(new SharedArrayBuffer(4)); a[0]=12; console.log(Atomics.store(a,0,5),a[0]);
JavaScript Reference