Standard built-ins

Atomics.load()

Try the free JavaScript compiler

Reads an integer element 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.load(typedArray, index)

Parameters & Attributes

NameTypeDescription
typedArrayinteger TypedArrayInteger view; floating-point and clamped arrays are not accepted.
indexnumberElement index, not byte offset.

Return Value

number | bigint

Current value.

Working Example

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