I am building an app using node.js and wanted to confirm an issue regarding modules and node's asynchronous nature. If I have a module such as:
var email_list = function() {
//perform some database query or calculation
}
exports.email_to = function() {
email_list.forEach(function(email) {
console.log(email);
});
};
And in another file, I call my email_to method, does the functionemail_list get called before my email_to function gets called? If not, is there a way to guarantee that the email_to function gets called after the email_list function?
Thanks in advance~
email_listfunction in your code, so no, it wouldn't be called beforeemail_to. Functions are only called when you call them.