Hacker News new | ask | show | jobs
by sakex 602 days ago
There is no preemption in Javascript. It is based on cooperative multitasking[1] (your await statements and non-blocking callback) which is the opposite of preemption.

[1]https://en.wikipedia.org/wiki/Cooperative_multitasking#:~:te....

2 comments

As anyone who has done the old setTimeout(fn, 0) trick in the browser probably knows.
They even created setImmediate(fn) for this purpose
If every line had an implicit await then it is indistinguishable from pre-emption, which I think is the point the person you're replying to is trying to make.