+ 2

thread simulation in javascript

javascript is a single-threaded language, all instructions are processed in the same thread, if things like an infinite "while" occur, the entire process is blocked. Is there a way to create or simulate two threads so that if one crashes the other will still work?

21st Jun 2022, 6:47 PM
JoseD
JoseD - avatar
2 Réponses
0
Unfortunately, you cannot. Javascript is completely single threaded. Even when running certain commands on the web, if you go into the Developer Tools and put in some kind of infinite loop, it will cause the rest of the webpage's functions to stop.
21st Jun 2022, 6:52 PM
Justice
Justice - avatar