JavaScript in Plain English

New JavaScript and Web Development content every day. Follow to join our 3.5M+ monthly readers.

Follow publication

Photo by Christopher Robin Ebbinghaus on Unsplash

Member-only story

How to Interchange Promises with Async/Await in JavaScript

David Fekke
JavaScript in Plain English
2 min readMar 12, 2021

--

From my blog.

One of the things that makes JavaScript so powerful is the way it handles asynchronous behavior. From the very beginning, JavaScript has used callbacks as a way of handling a response that may take a while to complete, without preventing your program from continuing to process other logic.

Retrieving or writing something to a database, filesystem or network are all examples of something that can block your program. The example below is a read request to a filesystem where the result is handled with a callback:

Promises

Promises were introduced in ECMAScript 2015 as another way of being able to handle asynchronous behavior using a more structured pattern. The basic problem with callbacks is that if you have to handle more than…

--

--

Published in JavaScript in Plain English

New JavaScript and Web Development content every day. Follow to join our 3.5M+ monthly readers.

Written by David Fekke

I am a software engineer and commercial pilot in jacksonville, Fl. I also produce videos for the Polyglot Engineer Channel on YouTube.

No responses yet

Write a response