What makes something thread-safe?

When two or more threads access a common data source, extreme care must be taken, because there is a high chance of data corruption and thread safety conditions such as deadlocks, preconditions, race conditions, and so on.

JavaScript did not add thread support from the very start. With web workers introducing a sort-of threading environment in JavaScript, it'll help to understand a few conditions associated with threads in general.

Get Learn ECMAScript - Second Edition 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.