I know, using the words JavaScript and \'atomic\'-anything in the same sentence is kinda strange, since JavaScript is prised to be asynchronous and therefor not very atomic.
JavaScript is inherently single-threaded. This means that if AJAX response arrives or timeout/interval should be triggered but other code is running, the response callback/timeout will wait.
This was one of the primary reasons why JavaScript was chosen for node.js.
See also:
Javascript is entirely single-threaded.
Async callbacks can only run when no other code is running using a message queue, like Windows messages.
All code runs on the UI thread and your code can never be interrupted in the middle (except by the Unresponsive Script warning)
Note that Javascript does support true multi-threading using HTML5 Web Workers.