Standard built-ins
Atomics.and()
Applies bitwise AND 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.and(typedArray, index, value)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| typedArray | integer TypedArray | Integer view; floating-point and clamped arrays are not accepted. |
| index | number | Element index, not byte offset. |
| value | number | bigint | Operand matching the view numeric type. |
Return Value
number | bigint
Previous value.
Working Example
Example Snippetjavascript
const a=new Int32Array(new SharedArrayBuffer(4)); a[0]=12; console.log(Atomics.and(a,0,5),a[0]);