4 ms·
can someone please build some visualization for me for this? A simple sketch will work.
by shivajikobardan 4y ago
can someone please build some visualization for me for this? A simple sketch will work.
- beardyw 4y agoThe above explains it. I am not sure a diagram will help. In the simplest of terms, your code will run until it has no more to do. If you set something else running (like request animation frame or fetch from the server) it may be doing something in parallel but the JavaScript code associated with it will only run when its turn comes. Only one part of your code is ever running at a time. You can run code in parallel yourself by creating a new environment called a worker but that is more advanced.
- shivajikobardan 4y agodiagram helps. I don't have time to share it by pasting to imgur here, but you can check this thread. https://forum.kirupa.com/t/why-does-if-condition-executes-in-this-requestanimationframe-code/656074/5 https://forum.kirupa.com/t/why-does-if-condition-executes-in...