What is the difference between Atomics.wait() and Atomics.waitAsync()?

JavaScript Professional Hard

JavaScript Professional — Hard

What is the difference between Atomics.wait() and Atomics.waitAsync()?

Key points

  • Atomics.wait() is synchronous and blocks the thread
  • Atomics.waitAsync() returns a Promise and can be used on the main thread
  • Atomics.wait() is not allowed on the main thread
  • Atomics.waitAsync() is asynchronous and non-blocking

Ready to go further?

Related questions