C++ Concurrency using JavaScript on #LeetCode

preview_player
Показать описание
I take a C++ Concurrency example in LeetCode and write the entire thing in JavaScript using the same API.

I had to change a few things, but the final solution is one that works the way you'd expect if you were writing something similar in C++. Unlike C++, JavaScript is single-threaded, so I can't make threads wait; instead, I have to use `setTimeout` to achieve my goals.
Рекомендации по теме