JavaScript: Mapping and Wrapping Classic Callback Functions to Promises and Async / Await

Callback functions used to be very common in JavaScript and Node applications. Out of necessity. And with Callback functions came unclear program flows, parallel realities, nested complexity and more.

ECMAScript introduced Promises several years ago and followed that up with the neat await and async syntax. This allows us to have asynchronous execution as part of the regular program flow. Everything orderly neatly and sequentially.