DEV Community

Discussion on: Asynchronous JavaScript - How I understand it.

Collapse
 
szilardszabo profile image
SS • Edited

Excellent and very very helpful article. I really really like the way that it clearly explains confusing topics and hidden, really less known aspects of Javascript.
I just want to make one small clarification about the terminology. I understand that it was not worded in this way as it might just confuses less educated developers but what is single threaded is not the Javascript language itself but most of the currently used Javascript engines that execute the code. More precisely threads are managed by the engine. So for example the V8 engine provides only a single stack and memory heap for your code, and executes it in a single thread, but it also manages other threads to support the execution on which you have no control over. So Javascript actually runs in a multi-threaded way by the engine, from which you only have 1 thread to control and use. But it is absolutely possible to create a different execution environment or call it "engine", that would run Javascript in a different way and use multiple threads for you Javascript code, especially if you run Javascript outside of a browser, e.g. as a standalone application If you google it, then you can even find examples of these.
It is absolutely true however that in most environment, especially in a browser your Javascript code runs as a single thread, so I don't want to confuse people about this fact.

Collapse
 
master_elodin profile image
Alexander Oguejiofor

Aha! Thanks for pointing that out.