logoalt Hacker News

gf000yesterday at 11:08 PM2 repliesview on HN

> This simplifies access to shared state without race conditions

But in ordinary JS there just can't be a race condition, everything is single threaded.


Replies

SkiFire13yesterday at 11:37 PM

You can definitely have a race condition in JS. Being single-threaded means you don't have parallelism, but you still have concurrency, and that's enough to have race conditions. For example you might have some code that behaves differently depending on which promise resolves first.

Kinranyyesterday at 11:16 PM

And it doesn't actually prevent concurrency.

show 1 reply