JavaScript has no native support for running multiple functions simultaneously. It has, historically, depended on time-consuming tasks (such as waiting for an HTTP request or doing something CPU intensive) being handled with native code that presents an API to JS (and that API accepting a callback or, more recently, returning a Promise).
That is starting to change.
Most web browsers support Web Workers and Node.js has introduced experimental support for Worker Threads.
These each allow JavaScript code to be farmed off to a separate process which runs independently of the main event loop and communicate with the main process using messages.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…