I'm having Javascript problem to wait a function done before the below line is called. The previous function is including the Javascript MYSQL Queries calls (one of the library of node.js). Then it will be looks like:
function first() {
/**
* a lot processes to execute
* including Asynchronous processes
* like running Queries using Javascript MYSQL Library from node.js
*/
console.log("I am the first one!");
}
first();
console.log("I am the second one!");
Then when i execute this, it happening like:
I am second one!
I am first one!
How do i make them run by keeping the queue order?
NOTE: Now for everyone who confusing the question, please jump/follow my newly created question again:
Everyone please follow/jump into this new question: Node.js MYSQL to detect the INSERT/UPDATE completeness of a Query?
first oneline reside in an asynchronous callback? Because what you're saying cannot happen otherwise.first, they are irrelevant in this regard. If I were to put the log call inside a callback of one of those calls, then it would happen of course. But that's not what the code in the OP is doing.