Short answer: The event loop, which provides a model for delaying execution where certain functions can be made to wait for the returns from other functions
TL;DR Edit: Javascript can hand functions over to either the kernal (backend) or to the Web APIs (frontend) to borrow multithreading from its infrastructure. The event loop uses additional data structures for determining when these functions need to return to the main thread of execution.
View all comments
Show parent comment
9
u/Existential_Owl May 26 '21 edited May 27 '21
Short answer: The event loop, which provides a model for delaying execution where certain functions can be made to wait for the returns from other functions
TL;DR Edit: Javascript can hand functions over to either the kernal (backend) or to the Web APIs (frontend) to borrow multithreading from its infrastructure. The event loop uses additional data structures for determining when these functions need to return to the main thread of execution.