Had a debate with my colleague on this, as we had to deal with some async/sync issues. However, it raised another question, which I couldn't figure out a definite answer for.
Assume a simple for-each loop ($.each), where for-each iteration I call a function set in the global scope. Does the function run synchronously or asynchronously? Assume no Ajax, so what the function does is completely synchronous, albeit merely executed. In other words, I wonder whether the function call itself is blocking within the iteration or not.
Thanks!
It is synchronous. You can tell if you set a breakpoint after the loop and one inside the loop. The breakpoint in the loop will be hit before the one after the loop.
This is assuming the breakpoints will be hit in the execution, object/array being looped over has items, etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With