How JavaScript works: Event loop and the rise of Async programming
One thing to note is that async programming like in JavaScript is "threadless" programming which means all your data-structures are by definition thread-safe.It's one less complication in your logic when you don't have to think "what if some other thread modifies this data while I am doing it?". And you never get hard-to-detect and hard-to-fix errors caused by that nor do you need to try to set up locks that might cause performance problems.So some might say that threads and locks and synchronization primitives are the solution while others might say they are the problem.