Atomics.and performs a bitwise AND between the value at that particular index in the typed array and the value you supplied:
const sab = new SharedArrayBuffer(1);const arr = new Uint8Array(sab);arr[0] = 5; // 5 is 0101 in binary.Atomics.and(arr, 0, 12); // 12 is 1100 in binaryconsole.log(Atomics.load(arr, 0));
Atomics.and here performs a bitwise AND between arr[0] and the number 12.
This outputs:
4