February 2018
Intermediate to advanced
298 pages
8h 22m
English
Similar to bitwise AND, Atomics.or method performs a bitwise OR:
const sab = new SharedArrayBuffer(1);const arr = new Uint8Array(sab);arr[0] = 5; // 5 is 0101 in binary.Atomics.or(arr, 0, 12); // 12 is 1100 in binaryconsole.log(Atomics.load(arr, 0));
Here, Atomics.or method performed a bitwise OR between arr[0] and the number 12.
The output is:
13
Read now
Unlock full access