Reputation: 305
I'm from a C background and find the asynchronicity of javascript very cool. I don't know however how things are asynchronous. Is it that every function-call is practically a new thread?
Upvotes: 0
Views: 585
Reputation: 30391
No, it's not a new thread: it's running an event loop.
Examples of systems in C that work the same way:
While you could think of it as a thread for a first approximation, it isn't really. Threads run in parallel, events are run serially. You never have to worry about concurrent access to data, but you do have to worry about starving the event loop (not returning to it often enough).
Upvotes: 5