“It’s single-threaded, you don’t need to worry about race conditions.”
Look, I know what you were told. No threads means no more worrying about concurrency, no more byzantine locking code, no more endless debugging sessions for errors that only happen 2% of the time.
Sure, we’ve come up with a few tools to help. We’ve got callbacks and Async.js, we’ve got promises, we’ve got Web Workers, event emitters, generators and iterators and soon we’ll have async/await. But which one to pick, and when? All of them have different trade-offs and are useful for different things.
In this book, I’ll help you understand the kinds of problems you’ll face writing asynchronous programs, what tools we have to help us and how to make best use of them, and take you on a tour of new ideas to further improve your code.