Understanding Synchronous and Asynchronous JavaScript - paRt_2: JavaScript - its DiFFereNt

In the first part of this post , we saw how the concepts of synchronous and asynchronous are perceived in JavaScript. In this second part, Mr K appears again to help us understand how the setTimeout() and AJAX APIs work. Let's go back in past to the story of Mr. K and the date you wanted to go on! but what if you leave a task for Mr. K before outing and tell him that he can only begin to work on this task five hours after he got your message. He isn’t happy about it! But why does Mr H leave a message in the queue instead of directly contacting Mr K? Because as I mentioned in the first part, the only way to contact Mr K is by leaving a message to him via phone call — no exceptions., remember, he doesn’t take a new message until he is done with the current one, and if he takes yours, he has to wait for five hours to even start on the task. So, to not be wasteful of time, he brings in a helper, Mr H. Instead of waiting, he asks Mr H to leave a new message for...