Node achieves this through what is known as the event loop. This concurrency page on the Mozilla docs has an Event Loop section which says that it is usually implemented using a
while loop which continously checks for events to fire.
The top of page explains that this is not typical of concurrency other languages like C or Java - these do not have the single-threaded limitation of JS.
In this talk by the Node creator, he explains in the first minute that the event loop (from the browser side) turned out to be necessary for the success of Node.
This is necessary because Node is single-threaded:
Follow the articles above for more detail on the event loop.
DEV has over 250k posts
Level up every day