This is a very interesting example. Can I ask if there is a reason for defining the post function before defining the establishQueueConnection function? In my mind I would do the opposite seeing the post function calls establishQueueConnection. So my question is: How do you reason about the order in which you define functions? When you are organizing your callbacks and async functions, how do you decide to order them in the way that you do? Thanks for teaching me !
Alex, I am not defining the post function before the establishQueueConnection. I am just declaring them. In JavaScript, declared functions are not executed immediately. They are "saved for later use", and will be executed later, when they are invoked, unlike in say C or C++. So, the order of writing them doesn't matter in JavaScript, the order in which you invoke them matters.