Asynchronous callback functions will always run after all synchronous code has been completed. This is because JS has something called the event loop which looks the following way:

Whenever we do asynchronous operation often this is associated with a Web API. This web API is abstracted away from us. We don't need to know how the browser implements this feature (which probably is written in C++ as part of the browser). However, we are interested in the value of operation or eventual return value.
So what the browser does is whenever the webAPI's are finished the callback associated with it is pushed in the callback queue. Then whenever the stack is empty the event loop will push an function on the stack.
This is why asynchronous operations will always be performed last, because the event loop will wait for the stack to be empty before pushing an item on it.
myFunctionshould change themetatag before the callback is called.