Skip to content

Instantly share code, notes, and snippets.

@rainabba
Created October 12, 2021 01:37
Embed
What would you like to do?
Clarifying javascript execution order
console.time('full execution');
console.time('code block');
function showExecutionOrder(parm) {
console.time('outside promise');
new Promise((resolve, reject) => {
console.time('inside promise');
resolve(parm);
console.timeEnd('inside promise');
}).then((data) => {
// Lookup mdn and invoke the account sync as required
console.log({ data });
});
console.timeEnd('outside promise');
}
console.time('function call');
showExecutionOrder({ foo: true });
console.timeEnd('function call');
console.timeEnd('code block');
console.timeEnd('full execution');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment