- The command console.log(1) gets into call stack and executing there.
- Next, the command setTimeout(func,0) tells to call stack to run the callback when all current stream is finished.SetTimeout makes it async and gets out function from the curren stream.Callback's gonna go to web Api,callback queue and call stack.
- Finally,console.log(3) is gonna run before setTimeout callback, cause this function is in current stream.
Last active
July 24, 2018 06:39
-
-
Save Rihovardini/d1f484fc81ca8fc27e1fc9206ec33e2c to your computer and use it in GitHub Desktop.
Event loop
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment