4 ms·
There are many things to hate about JavaScript but the inbuilt forced async nature is one thing I absolutely love about it. Thank god that except a few reminant
by superasn 5y ago
There are many things to hate about JavaScript but the inbuilt forced async nature is one thing I absolutely love about it. Thank god that except a few reminants like `alert` and `prompt` almost everything is async by default.
I remember that just until a few years ago the whole tabs and everything would freeze if a site showed a blocking alert popup. Can't imagine what it would do if other things like http req, dom operations, etc were also synchronous.
- awestroke 5y agoDOM operations are always synchronous. When modifying DOM, there is often a full layout+paint cycle before the next line is run.
- thomasz 5y agoThere is no inbuild async nature. It just did not have a stdlib whatsoever, so node could come along and offer a completely async one. There were async server frameworks in python before, like twisted and tornado. For a long, long time, the language itself lacked almost all of the niceties that make async programming bearable. Node code quickly devolved into a giant mess of callbacks nested twenty levels deep.