Photo by Ferenc Almasi on Unsplash
// Pass callback to function ajax
var callback = function(image) {
ajax.get("", callback);

// Can be abbreviated as follows
ajax.get("", function(image) {

From callback, promise comes to Async/Await.

The code becomes neat when moving from callback to promise.
See Promise objects as if they were synchronized objects.

Why use async / await?

Async / Await makes the code neat.

Shortcomings of async / await

Apply async / await to your code



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store