Understanding Javascript Promises
JavaScript’s promises and async/await might seem complicated at a glance and there are a lot of pitfalls beginners fall for, in this post I will try to explain everything you need to get started. Callbacks First we have to take a step back and realize what promises are trying to replace. Callbacks. In JavaScript some functions can be asynchronous, meaning it might take some time before it has results to give you, and while JavaScript is single-threaded, certain I/O functions can run asynchronously in the host environment (such as the browser or Node....