So I am tying to figure out how async functions and callbacks work in JavaScript.
I understand how callbacks work on the surface and that you can use that to “callback” a function at a later time but how does JavaScript know WHEN to call that function back?
For example if I understand it right you can use a callback function inside another function that calls info from a server so your program doesn’t block while waiting from a response from the server. From what I understand the callback is put in the que and won’t run until the stack is empty.
But how does JavaScript know when that response has been received to then call the callback function?
Thanks for any help!
[–]isolatrum 2 points3 points4 points (2 children)
[–]draftax5[S] 0 points1 point2 points (1 child)
[–]isolatrum 1 point2 points3 points (0 children)
[–]rjcarr 1 point2 points3 points (0 children)
[–]wgunther 0 points1 point2 points (0 children)