As mentioned earlier, asynchronous patterns are important to the single-threaded Javascript language and are a core feature of Javascript. It is also because of a large number of asynchronous mode API relations, so we write JS code, relatively not so easy to read, the order of execution will be relatively complex, especially for complex asynchronous logic.
Syntaxes that are designed for asynchrony in JS, especially the new syntaxes and features introduced after ES2015. These syntactic features, they slowly make up for the shortcomings, or inconveniences, of asynchronous programming in Javascript. The fundamental way to implement asynchronous programming in Javascript is the callback function. In fact, the fundamental way to implement asynchronous programming is the callback function.
A callback function can be thought of as something you want to do, defined by the caller and given to the executor. The specific use is to pass functions as arguments, which has the disadvantage of being unreadable. In addition to the callbacks, there are event mechanisms and publish-subscribe which are actually variations on the callbacks.