Please enable JavaScript.
Coggle requires JavaScript to display documents.
Node js (how php/asp work by contrast (How node works (Here is how Node.js…
Node js
-
Asynchronous
The function calls are never direct in JavaScript, they’re literally done via messages.
when a function is run, javascript adds it to a message queue. here it's dispatched sequentially to the call stack by the event loop once the callstack is empty of all frames from the previous message. here the functions are stacked as frames (function arguments and variables)
calling the setTimeout() function sets a timer and the new message joins the queue once the timer has expired
the delay time in setTimeout() does not indicate the time when the code execution starts, but the time when the timer expires and a new message is queued, which will only be processed when the call stack is free to do so.
-
-
-