February 2018
Intermediate to advanced
298 pages
8h 22m
English
The Atomics.load method returns the value inside a typed array at a particular index value. Here's how to use it:
const sab = new SharedArrayBuffer(1);const arr = new Uint8Array(sab);arr[0] = 5;console.log(Atomics.load(arr, 0));
The preceding code is just a thread-safe way to access arr[0].
This outputs:
5
Read now
Unlock full access