Timed execution

By nature, JavaScript code executes synchronously, that is, you don't have multiple threads of control, each running a piece of your code and competing for the CPU's attention. There are web workers in modern browsers, but these are far from commonplace yet and don't share much similarity with a threading API you'd find in another language. The upside to all of this is that you, as the programmer, don't need to concern yourself with synchronization primitives and all the other nasty details associated with multithreaded programming.

Instead, you face a different kind of difficulty in that you have to deal with events, the DOM, and other forms of callbacks; so much for synchronous code. Sometimes, this is actually desired. For example, ...

Get Lo-Dash Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.