JavaScript Atomics Reference Last Updated : 18 Apr, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report Atomics is an object in JavaScript that provides atomic operations to be performed as static methods Just like the Math object in JavaScript, all the properties and methods of Atomics are also static Atomics are used with SharedArrayBuffer (generic fixed-length binary data buffer) objects Atomics are not constructors like other global objects Atomics cannot be used with a new operator or can be invoked as a functionSyntax:Atomicsmethod(argument 1, argument 2, )Example: In this example load() function of the Atomic object returns the value at a given position of an array JavaScript // creating a SharedArrayBuffer let buf = new SharedArrayBuffer(25); let arr = new Uint8Array(buf); // Initialising element at the zeroth //position of an array with 9 arr[0] = 9; // Displaying the SharedArrayBuffer console.log(Atomics.load(arr, 0)); Output:9JavaScript Atomics Methods: The complete list of JavaScript Atomics methods are listed below MethodsDescriptionsadd( )Given the position in an array and return the old value at that positionand( )Compute a bitwise AND with a given value at a given position in the arraycompareExchange( ) It compares and exchanges a replacement valueexchange( )This is used to exchange and store a new value at a specific position in an arrayis lock-free( )Returns true if the given size is one of the BYTES_PER_ELEMENT properties of integerload( )Returns the value at the given position of the arraynotify()Notify some agents that are sleeping in the wait queueor( )Compute a bitwise OR operation with a given value at a given position in an arraystore( )Returns the value which was has been storedsub( )Returns the old value at that positionwait()Returns a string that is either “ok”, “not-equal”, or “timed-out”waitasync()Returns a promise without blocking the main threadxor( )Compute a bitwise XOR operation with a given value at a given position in an array Comment More infoAdvertise with us Next Article JavaScript Atomics Reference K kartik Follow Improve Article Tags : JavaScript Web Technologies JavaScript-atomics Similar Reads JavaScript Atomics store() Method What is Atomics? The Atomics is an object in JavaScript which provides the ability to perform atomic operations as static methods.Just like the Math object in JavaScript all the properties and methods of Atomics are also static.Atomics are used with SharedArrayBuffer(generic fixed-length binary data 3 min read Atomics.xor() In JavaScript What is Atomics? The Atomics is an object in JavaScript that provides the ability to perform atomic operations as static methods.Just like the Math object in JavaScript all the properties and methods of Atomics are also static.Atomics are used with SharedArrayBuffer(generic fixed-length binary data 3 min read JavaScript Atomics notify() Method The Atomics.notify() is an in-built method in JavaScript that is used to notify some agents that are sleeping in the wait queue. The Atomics.notify() method returns a number of woken-up agents. The integer-typed array, index, and count are passed as an argument to the function. Syntax:Â Atomics.noti 2 min read JavaScript Atomics add() Method Among the Atomic Operations, there is a method Atomics.add() that is used to add a given value at a given position in an array and return the old value at that position. No other write operation can happen until the modified value is written back.Syntax: Atomics.add(typedArray, index, value) Paramet 2 min read JavaScript Atomics and( ) Method Among the Atomic Operations, there is a method Atomics.and() that is used to compute a bitwise AND operation with a given value at a given position in an array. The old value at that position is returned by Atomics.and() function. No other write operation can happen until the modified value is writt 2 min read Like