I have the code below:
function foo() {
setTimeout(function() {
console.log("a");
}, 0);
console.log("b");
console.log("c");
}
In my console, I have the result below:
b
c
undefined
a
I need get the result below:
undefined
a
b
c
The commands to print "b" and "c", need stay in the root foo function.
How to do it?
-
The case above simplifies my need.