I am learning the concept of asynchronous functions in JavaScript. I know JavaScript is single threaded and call back functions are put behind the synchronous executable code in the thread. This article explained pretty good. https://www.sohamkamani.com/blog/2016/03/14/wrapping-your-head-around-async-programming/
But the article did not explain one questions I have, what if there are multiple call back functions in the code? For example, the below code, what is the order of execution? Is async function 1 or async function 2 executed first?
var request = require('request');
// async function 1: take 200ms
request('http://sohamkamani.com', function (error, response, body) {
console.log(body);
})
// async function 2: take 100ms
request('http://facebook.com', function (error, response, body) {
console.log(body);
})
console.log('I come after the request');